[codex] add long-form generation mode#313
Open
Lee-take wants to merge 4 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.