Repository navigation
Conversation
hans00
added a commit
that referenced
this pull request
Nov 15, 2026
Per review: memory caches the context a model needs (sliding-window K/V, conv tails, convtr overlap partial sums, position) and nothing else. Removed flush, the ended state, input buffering, held-back output, the WINDOW kind and the in-library crossfade; each call returns exactly what a stateless call returns for its input. Encode chunks must be hop-aligned (the batch tail padding and the measured effect of caller zero-padding are documented). v1 supports causal models only; #6's host windowing stays the fallback. codec_model_memory_kind becomes codec_model_has_memory; codec_memory_n_frames and the speaker question are dropped (reference-voice state is a future codec_speaker proposal). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hans00
added a commit
that referenced
this pull request
Nov 15, 2026
Per review: codec_model_has_memory becomes codec_model_is_causal (no look-ahead; memory then makes streamed output equal batch; non-causal parts have memory size 0). enum codec_memory_type becomes the bit set enum codec_part (NONE / ENCODER / DECODER / ALL), shared by the memory field, clear's `parts` and the state calls. Save/restore moves to the context as in llama.cpp: codec_state_get_size / get_data / set_data. The #6 streamer takes the incremental path when the decoder is causal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hans00
added a commit
that referenced
this pull request
Nov 15, 2026
…keys
Per Hans's approved direction: drop enum codec_part. One memory handle
per side (encoder_memory / decoder_memory params,
codec_get_encoder_memory / codec_get_decoder_memory), clear and state
save/restore on the handle (deliberately unlike llama_state_*(ctx)),
codec_model_encoder_is_causal / codec_model_decoder_is_causal.
New GGUF keys codec.{encoder,decoder}.{look_back,look_ahead} in frames,
written by converters; is_causal = look_ahead == 0; -1 = unbounded;
look_back on a causal side is the cached context length. Missing keys
fall back to per-arch defaults (old GGUFs load); #6's window table
becomes those defaults. Adds a Rollout section (published GGUFs updated
in place later, each upload approved separately).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HF descript/dac_16khz's config says hop_length 512, but its ratios (2*4*5*8) give 320, and the converter wrote the config value: codec_model_hop_size reported 512 for a 320-sample hop. The loader now takes the product of the decoder blocks' ConvTranspose strides when the weights disagree with codec.hop_size (with a warning, so existing GGUFs are right without re-converting), and the converter writes the product of downsampling_ratios. Decoded audio is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he rest from look_* codec_audio_lm_stream_poll, rebuilt on the codec memory API (#9): - Causal decoders (codec_model_decoder_is_causal with memory state: Qwen3-TTS-Tokenizer-12Hz, Mimi, NeMo, MOSS-Audio): each poll decodes only the new frames, in whole chunk_ms pieces, on a second codec context with decoder_memory, created at the first stream. No hold-back, no cross-fade; the stream equals the batch decode to float rounding (Qwen3 ICL rel. RMS 8.2e-4, CSM/Mimi 4.8e-5). - ICL voices: the reference's codes are decoded into the memory once per voice; the memory state after them (codec_memory_state_get_data) is kept in the audio_lm context and restored for the next generation with that voice. Batch decodes are unchanged (they still decode reference + generation on the context's own codec context and cut). - Other decoders: the stateless window of the windowed streamer, with left context and hold-back read from codec.decoder.look_back / look_ahead (GGUF keys, else the per-arch defaults) instead of a per-arch table. An unbounded look_back or look_ahead decodes from the first frame (exact, quadratic) and holds back 0.32 s, as before. Internal only: src/audio_lm_stream.h, src/audio_lm_window.h and src/codec_look.h are in the audio_lm objects' private include dir. No change to include/ or common/*.h. tests/e2e/audio_lm_stream_smoke.py checks the memory path against batch (rel. RMS <= 1e-3, a repeat stream with the restored ICL state identical) and the windowed path (DAC) perceptually. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hans00
force-pushed
the
fix/streaming-incremental-decode
branch
from
November 16, 2026 03:29
ae35a74 to
bf5f788
Compare
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.
Reworked on top of #9 (codec memory); base is now
feat/codec-memory, so the diff shows only this PR. The earlier versions (stateful Qwen3 stream graph, then windowed stateless streaming) are replaced.codec_audio_lm_stream_poll/_finish:codec_model_decoder_is_causal, with memory state: Qwen3-TTS-Tokenizer-12Hz, Mimi, NeMo, MOSS-Audio): each poll decodes only the new frames, in wholechunk_mspieces, on a second codec context withdecoder_memory, created at the first stream. There is no hold-back and no cross-fade, and the stream equals the batch decode to float rounding.codec_memory_state_get_data) is kept in the audio_lm context and restored withset_datafor the next generation with that voice. Batch decodes are unchanged: they still decode reference + generation on the context's own codec context and cut, so batch output is bit-identical.codec.decoder.look_back/look_ahead(the GGUF keys, else the per-arch defaults) instead of a per-arch table. An unbounded look (-1) decodes from the first frame and holds back 0.32 s, as before.Public headers (
include/,common/*.h): no changes (gh pr diff --name-onlylists none). The new headerssrc/audio_lm_stream.h,src/audio_lm_window.handsrc/codec_look.hsit in the audio_lm objects' private include dir and are not installed. Note: thecodec_audio_lm_stream_pollcomment ininclude/codec_audio_lm.hstill says "re-decodes the generation from its first frame". Updating it is a public-header change, so I left it alone; it can go into a later proposal.Tests:
tests/e2e/audio_lm_stream_smoke.py:codec_memory_smoke.pyOK,audio_lm_host_smoke.pyOK,python_tts_smoke.pyOK.ttsserver_smoke.pyfails one check, "two paragraphs did not run as two segments". It fails the same way onfeat/codec-memorywithout this PR (KittenTTS, no streaming involved).Phone (Pixel 7 Pro, live-translate 0.3.13 vendoring this branch at bf5f788; Qwen3-TTS-12Hz-0.6B Base, x-vector voice, 6 zh-TW lines, 960 ms pieces):
🤖 Generated with Claude Code