yue2: continue a song from given semantic tokens - #641
Merged
Merged
Conversation
engival
force-pushed
the
yue2-semantic-prefix
branch
2 times, most recently
from
September 22, 2026 01:47
b7ddc3e to
4ee81d1
Compare
engival
marked this pull request as ready for review
September 22, 2026 02:52
Owner
|
@engival I think there’s some overhead when
|
semantic_prefix (inline JSON array) and semantic_prefix_file force the first N semantic frames: the AR stage prefills them behind the prompt and samples from frame N. The forced frames count toward semantic_min_tokens, semantic_max_tokens and the repetition penalty window, so min = max = T stops at an exact length and N = T renders the given tokens without sampling. With cot=melody or cot=full a prefix requires abc or abc_file. Requests without the option render as before. When the prefix already fills the window (N = semantic_max_tokens) the AR stage is skipped: the given frames are the stream, stop_after=semantic returns them as they came, and stop_after=audio prefills them once in the NAR stage for its conditioning. examples/yue2_style_change uses it, with stop_after and export_semantic, to change a song's style part-way through from audiocpp_cli alone.
engival
force-pushed
the
yue2-semantic-prefix
branch
from
September 22, 2026 13:23
4ee81d1 to
f409158
Compare
Contributor
Author
|
Yeah, that was an oversight. It now short-circuits to skip the AR phase in that case. |
Owner
|
@engival Thanks! PR merged. |
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.
What it enables: changing a song's style part-way through, by editing the token history the model continues from. Demo: https://youtu.be/gMS2Ko7s97o
What it adds
semantic_prefix (inline JSON array) and semantic_prefix_file: the first N semantic frames are given instead of sampled. The AR stage prefills them behind the prompt and samples from frame N. They use the same format export_semantic writes.
Example
examples/yue2_style_change/ is the whole workflow with audiocpp_cli and the Python standard library only. It renders one score in two styles (stop_after=semantic, export_semantic), splices the token lists, continues from the edited history, and renders the result. It ships a score and lyric so the default run is reproducible. Happy to move it out of the repo if you'd rather not carry it.
Validation (Intel Arc B70, Vulkan)
Notes
Deterministic for a given request, but not the same draws as an uninterrupted run (the RNG starts at the first sampled frame). With guidance ≠ 1.0 the prefix prefills through host K/V, so memory grows with N. The default cot=full route is single-stream on device.