Repository navigation
🚨 Use shared Mimi decoding for PocketTTS and correct streaming history - #1320
Merged
Merged
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
Move PocketTTS onto the existing session-owned
MimiLatentDecoderRuntimeused by PocketTTS Small, removing its model-local Mimi decoder and AudioDecoder wrapper. Keep normalization and text-chunk resets in the model session, and reuse compatible decoder graphs instead of discarding them at the start of every offline request.No framework, GGML, kernel, model-spec or public-option changes. Production precision, AR execution, RNG, voice preparation and text chunking remain unchanged. Gradium Phonon continues using the shared PocketTTS session.
The migration retains in-graph KV updates, per-text-chunk state resets, protected constant/state lifetimes, CUDA graph ELU and CPU depthwise upsampling from the earlier decoder fixes and optimizations.
Upstream attention correction
Original PocketTTS and Small use the same upstream attention implementation. Its causal window includes every key satisfying
0 <= query_position - key_position < context.The old PocketTTS port retained
context - block_framesprevious positions: 234 for context 250 and a 16-frame block. After the cache fills, early queries lose up to 15 valid keys. The existing framework runtime already retains the correct 249-position prefix, so no alternative layout or compatibility option is added.Controlled FP32 replay uses identical package weight values expanded to F32 and the exact C++ denormalized latent inputs, with unmodified official Python code. It crosses the cache-fill boundary:
CPU/CUDA now pass cosine >0.99999. Vulkan improves but remains below that strict gate, with numerical differences also present before the history boundary; strict Vulkan/Python waveform parity is not claimed. Streaming/bounded output changes are the intended attention correction, rather than a claim of byte-identical output against the defective path.
Performance
Main
28a6fe7bbversus this PR, Debug builds, eight threads, matching published English BF16/Q8 packages and seed 42. Sequential warmed A→B→B→A; each block has two excluded warmups and ten measured requests, giving 20 measurements per condition. CUDA: RTX 5090. CPU: Ryzen 9 7900X.Offline rows use default full-sequence decoding. Streaming rows use true SSE audio. RTFs are pooled medians; process peak memory includes preparation and is sampled every 20 ms.
CUDA streaming RTF decreases about 35%; CPU offline decreases 14–17%, and CPU streaming 6–7%. Default CUDA BF16 offline is effectively unchanged. Explicit bounded decoding (
pocket_tts.use_full_mimi=false) also improves: approximately 39% on CUDA and 7–9% on CPU. Both run orders improve in all 12 measured configurations, with no observed RTF or peak-memory regression.Warmed streaming TTFA, cold-start excluded:
Regression and lifecycle validation
Metal/HIP execution and forced-OOM recovery were not tested in this pass.