Repository navigation
perf(irodori_tts): leave caption tokens out of the RF context without a caption - #1170
Merged
Merged
Conversation
… a caption On caption-conditioned checkpoints (v3 VoiceDesign, v4) every request carried max_caption_len (512) caption tokens through the RF context, even without a caption, where all of them are masked out. They still took K/V memory in every DiT layer and attention work at every step. Requests without a caption now pass no caption state to the RF and MeanFlow samplers, so the context holds only text and speaker tokens. Masked keys add nothing to attention, so the result is the same up to floating-point order: outputs with a caption are byte-identical, outputs without one differ at the level of other numerical changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Owner
|
@KKTTSPJ 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.
Summary
On caption-conditioned checkpoints (v3 VoiceDesign, v4 Small, v4.1 Small, v4 Large), the RF context always holds
max_caption_len(512) caption tokens, also for requests without a caption, where every one of them is masked out. They take K/V memory in every DiT layer (512 of the 770 context tokens without a reference) and attention work at every sampling step, and contribute nothing.With this PR, requests without a caption pass no caption state to the RF and MeanFlow samplers, so the context holds only the text and speaker tokens. Requests with a caption, and checkpoints without caption conditioning, are unchanged.
src/models/irodori_tts/rf_dit.cpponly.Python Irodori-TTS also pads to 512 masked tokens. Masked keys add nothing to attention, so the result is the same up to floating-point order. The output is not byte-identical: the attention reduces over a different number of keys.
This is independent of #1168 (the K/V copy in the step graphs) and merges cleanly with it. The 40-step measurements below have #1168 applied on both sides.
Validation
RTX 5060 Ti, CUDA 12.8, 40 steps, codec chunking on (
codec_decode_chunk_steps=100,codec_encode_chunk_steps=100), with and without this PR.With a caption: byte-identical (v4 Small Q8_0, v4 Large Q8_0 and Q4_K).
Without a caption (log-mel frame cosine against the output without this PR):
Existing checkpoints against
main(Q8_0, 16 steps, seed 42): v3 500M (no caption conditioning) and every request with a caption are byte-identical; without a caption, v4 Small 0.9997 / 0.9962, v4.1 Small 0.9773 / 0.9999, v3 VoiceDesign 0.9999 / 0.9991 (no reference / reference audio).Lengths are unchanged in every case. The changes are of the size other numerical changes cause after many steps, not a shift in one direction. Against Python fp32:
The v4.1 Small case is the largest change we saw. It comes from Q8_0, not from this PR: the same line with the F16 package, or with Q8_0 at 40 steps, is unchanged by it (
mainbinary vs this PR on top of #1168, which does not change output; both against Python fp32):At Q8_0 this line's sampling trajectory is sensitive to small numerical differences: at 40 steps it is already 0.96 from Python without this PR. Any change in floating-point order can tip it, as this one does at 16 steps.
Listening check: only the Q8_0 16-step v4.1 Small line could be told apart, as roughly one breath's worth of timing difference, with no effect on audio quality. The v4 Small reference-audio case (0.9904 above) could not be told apart.
Peak GPU memory (increase over idle, sampled every 50 ms):
The saving shows where sampling sets the peak, here v4 Large with reference audio (about 0.3–0.4 GB). Elsewhere the weights and the codec set the peak. Run times did not change measurably.
🤖 Generated with Claude Code