[codex] add long-form generation mode#313
Conversation
|
Thanks a lot for this PR, @Lee-take! 🙏 The long-form direction is great, and I really appreciate that this is a pure API/CLI-level mitigation — no model weights or decoder internals touched. A few details are genuinely well done:
I pulled the branch and ran the unit tests (22/22 green) and probed the text splitter on real-world inputs. A few things I'd love to see addressed before we merge 👇 🔴 Should fix before merge1.
Root causes: (a) 2. 3. The seed prompt is re-fed to every later segment. 🟡 Worth discussing4. 5. Python API has no 6. 7. Minor: for the first segment, 🧪 Test suggestion
Really solid contribution overall — the splitter robustness (1) and the default consistency (2) are my main blockers; the rest are mostly polish. Happy to help review the follow-up. Thanks again! 🎉 |
Summary
VoxCPM.generate_long_form()for long scripts by splitting text into shorter segmentsprompt_textmatches the spoken transcript, excluding voice-design control text that is not spoken--long-form,--long-form-max-chars, and--long-form-silence-msWhy
Very long single-pass generation can accumulate autoregressive drift. The long-form path keeps each generation pass short and re-anchors later segments with stable prompt context, which is an API/CLI-level mitigation that does not change model weights or decoder internals.
The generated seed segment is no longer duplicated as both reference audio and prompt audio. If no external reference is supplied, the long-form path uses prompt continuation only; if the caller supplies an external reference, it is preserved as reference conditioning. This avoids over-conditioning on the same generated seed audio while still keeping a stable continuation anchor.
The seed prompt transcript must match the seed prompt audio exactly. Voice-design control text guides the first generation pass, but it is not part of the spoken audio; including it in later continuation prompt text can make the continuation conditioning inconsistent and degrade long-form output.
Tests
python -m pytest tests/test_core_long_form.py tests/test_cli.py -qpython -m compileall src tests -qpython tests/test_voxcpm_long_form.pyandpython tests/test_voxcpm2_voice_anchor.pyNot run: full model-dependent upstream test suite, because this local PR environment only installed lightweight unit-test dependencies and no full torch/model runtime.