Repository navigation
Conversation
decode_rnnt_stream continues a persistent predictor state (LSTM h/c, the last emitted token and whether the stream started) instead of restarting the greedy loop per chunk, and numbers emitted frames from the utterance start. The state is self-contained, so a resumed stream does not re-pass its token list. The one-shot entry point is a thin wrapper over the same loop. The unit test feeds the same frames in 2, 3 and 5 chunks and requires identical tokens and frames, then runs one tail from two different predictor states and requires the resulting state to differ. That last check fails if the decoder resets the state at entry (verified by mutation). Part of handy-computer#310
GigaAM-v4 checkpoints ship cfg.streaming.contexts, the future-context presets the reference's stateful stream supports. The converter validates them against the encoder's chunk_size/window_size spelling of the same attention band and writes them into the GGUF; the loader reads them into GigaamHParams. A GGUF without the keys stays offline, and stt.capability.streaming stays false until the family registers the stream hooks, so nothing changes for an existing checkpoint. The loader bounds the frame and both contexts (the contexts in frames, since that is what the graph sizes a mask from), checks that frame_ms matches the frontend's own frame, and the converter refuses a config the loader would reject. Part of handy-computer#310
Entry validation for the streaming decoder (shapes, and a carried token inside the predictor vocab, which indexes the embedding table), output arrays trimmed together on failure, and the frame base advanced only on success. The loader validates the mel geometry unconditionally (positive sample rate, n_fft, win_length, hop_length, and win_length <= n_fft), requires one predictor LSTM layer as the decoder drives a single layer, refuses a streaming config whose frontend hparams cannot produce its frame, bounds the frame computation against int64 overflow, and caps the context list at the encoder stage count. The decoder unit test gains a write-back check that fails if the state is mutated only in local copies (verified by mutation), plus refusals for an out-of-vocab carried token, a negative one and a null input. One negative GGUF fixture covers each new loader refusal; gigaam_smoke asserts both TRANSCRIBE_ERR_GGUF and the diagnostic of the guard, so a fixture that regresses to an earlier rejection does not pass. Part of handy-computer#310
The chunked streaming encoder needs three host-side pieces before the graph exists: how many frontend frames a feed consumes, the band attention bias per stage (chunk alignment over absolute frames plus the left context, with key validity for a partially filled final feed and for the valid tail of the past cache), and the cache roll. The unit test pins the mask with hand-computed scenarios for ds=1 and ds=2, a partially valid final feed and a full-attention chunk mode, then sweeps invariants that do not restate the formula: invalid keys are always masked, the chunk rule opens the whole chunk, the band opens [left, 0], and no allowed past key falls outside those two. Part of handy-computer#310
A feed consumes 4 * chunk mel frames and carries the four conv input caches that replace the offline graph's causal zero padding. The graph is chunk-size independent: the unit test runs the same mel sequence as one feed and as three, copying each cache to the next feed, and requires the encoder frames to match. Part of handy-computer#310
Mirrors the reference _stream_layer / _forward_chunk: attention over the cached query/value history with the band mask and RoPE at absolute positions, the conv module over the cached mean window with chunk-local future taps, and per-stage downsampling. Every cache is a graph input/output pair the caller carries between feeds. The unit test builds the same toy model twice: offline over the whole utterance, and streaming as a single feed whose left context covers it. With one chunk the band mask degenerates to full attention, the mean window covers every frame and the future taps reproduce the offline symmetric padding, so the two encoder outputs must match. Part of handy-computer#310
Register the stream hooks for the Zapformer family. begin picks the future-context preset (the reference's default: the largest), sizes and zeros the per-layer caches by building the graph once, and resets the decoder state. feed turns new PCM into mel frames, runs every whole chunk through build_zapformer_stream_encoder, decodes the new frames with decode_rnnt_stream and publishes the cumulative transcript. finalize drains the zero-padded tail chunk. The converter marks a checkpoint with a streaming config as streaming-capable, and the toy fixture follows, so the capability and the hooks agree. The smoke test now drives begin/feed/finalize through the public API.
GigaAM-v4 checkpoints converted with the streaming config now run as a stateful stream. Document the API, the context presets, the commit policies and the bounded memory in the family and variant pages, and mark streaming on the catalog row for the v4 variant only.
The stream uses the largest advertised future context by default, as the reference does. TRANSCRIBE_GIGAAM_STREAM_CONTEXT_MS selects another advertised preset by its millisecond value; the reference parity check uses it to compare 160, 320 and 640 ms.
The real-model smoke streams samples/jfk.wav through the public API in 100 ms packets at each advertised future context and requires the exact transcript that GigaAMStreaming from modeling_gigaam.py produces at the pinned revision: 160 and 640 ms differ from 320 ms only by a comma. The test is skipped unless TRANSCRIBE_GIGAAM_V4_GGUF points at a converted checkpoint with the streaming config.
The Multilingual-v2 merge (handy-computer#311) validates the Zapformer frontend dimensions before the streaming block, so a zero-subsampling fixture no longer reaches the streaming check; drop it. Also fix a leftover loop header from merging the mutant table.
shaba
force-pushed
the
gigaam-v4-streaming
branch
from
December 4, 2026 16:18
f6cde25 to
9fba5a3
Compare
This branch has not been deployed
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
GigaAM-v4 GGUFs that carry the checkpoint's streaming config now run as native streams through
transcribe_stream_begin/feed/finalize(16 kHz mono float32 PCM). The chunked encoder followsthe reference
GigaAMStreamingfrommodeling_gigaam.py: per-stage frontend caches with validmasks, per-layer attention and convolution caches, a chunk-aligned band mask with a 32-frame left
context, RoPE at cache-relative stage positions, and RNN-T decoder state carried across chunks.
What changed
src/arch/gigaam/stream.{h,cpp}: host-side streaming geometry (feed arithmetic, band attentionbias, cache roll, the band-major mel buffer).
src/arch/gigaam/encoder.{h,cpp}: chunked streaming graph for the Zapformer encoder, withcache inputs/outputs.
src/arch/gigaam/model.cpp,gigaam.h: stream hooks for the family. The preset defaults to thesmallest advertised future context (160 ms);
TRANSCRIBE_GIGAAM_STREAM_CONTEXT_MSselectsanother advertised one.
scripts/convert-gigaam-v4.py: checkpoints with a streaming config are marked streaming-capable.src/arch/gigaam/weights.cpp: frontend geometry validation now also rejectshop_length > win_length.tests/gigaam_stream_*,tests/gigaam_smoke.cpp: tests listed below.docs/models/gigaam.md,docs/models/gigaam-v4-e2e-rnnt.md: streaming documentation.Validation
transcribe_gigaam_stream_geometry_unit: feed arithmetic, band attention mask, cache roll, andthe streaming mel buffer under different feed splits.
transcribe_gigaam_stream_frontend_unit: chunked feeds equal the offline causal frontend,independent of feed size.
transcribe_gigaam_stream_encoder_unit: one covering chunk equals the offline encoder output,including a ds=2 stage and a kernel-1 stage, and reads the caches written by earlier feeds.
transcribe_gigaam_stream_real_smoke: streamssamples/jfk.wavin 100 ms packets at 160, 320and 640 ms and matches the reference transcript exactly.
gigaam_smoke.cpp: begin/feed/finalize smoke on the public API.Compatibility
Offline paths and GigaAM-v3 are unchanged. GGUFs converted without the streaming keys stay
offline-only.
GigaAM-Multilingual-v2 has its own offline port in #311. It carries the same streaming contexts,
but wiring its language-conditioned encoder to the stream is tracked separately in #312.
Fixes #310.