Skip to content

Commit ea7f072

Browse files
justinchubyCopilot
andauthored
Audit audio and codec GGUF cohort (#586)
## Summary - audit `pockettts`, `qwen3tts`, `talkie`, and `wavtokenizer-dec` against llama.cpp `8d9af256337d1a501250f9bbf4c0859a654bddd6` - pin suffix-exact converter tensor inventories and negative closure/misdispatch invariants - defer every graph/runtime claim rather than aliasing partial TTS backbones, a novel text LM, or ISTFT parameters to existing Mobius tasks - document exact companion sidecars, conditioning/state/rate semantics, overloaded WavTokenizer dimensions, quantization constraints, and pinned real artifacts ## Decisions - PocketTTS requires matching `pockettts_spkenc` and `pockettts_gen` sidecars; its primary GGUF has no semantic LM head. - Qwen3-TTS is the transformed talker only, not Mobius `Qwen3TTSForConditionalGeneration` or `Qwen3TTSTokenizerV2Model`; speaker encoder, 15-codebook predictor, and code-to-wave decoder are companion-owned. - Talkie is a text LM with weight-free RMSNorm, post-RoPE Q/K normalization, gain sidecars, and per-layer embedding skip. - WavTokenizer decoder emits non-causal `T x 1282` ISTFT parameters, not waveform audio; exact 24-kHz/hop-320 reconstruction remains processor-owned. All four remain `DEFERRED`: the GGUFs are valid, but complete Mobius graphs and independent parity evidence do not yet exist. ## Validation - `python -m pytest src/mobius/integrations/gguf/_arch_registry_test.py src/mobius/integrations/gguf/_upstream_gap_test.py src/mobius/integrations/gguf/_builder_test.py -q --tb=short` (876 passed) - broad non-integration suite excluding the pre-existing `glm_moe_dsa` shape-inference failure (5,989 passed, 52 skipped) - `lintrunner --output oneline --all-files` --------- Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Copilot App <[email protected]>
1 parent b425a9f commit ea7f072

13 files changed

Lines changed: 1355 additions & 56 deletions

File tree

‎docs/api/build_from_gguf.md‎

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,14 @@ reason.
194194
| `olmoe` | — | `olmoe` | runtime deferred | supported |
195195
| `phi3` | — | `phi3` | supported | supported |
196196
| `phimoe` | — | `phimoe` | runtime deferred | supported |
197+
| `pockettts` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
197198
| `qwen2` | — | `qwen2` | supported | supported |
198199
| `qwen2moe` | `qwen2_moe` | `qwen2_moe` | runtime deferred | supported |
199200
| `qwen3` | — | `qwen3` | supported | supported |
200201
| `qwen35` | — | `qwen3_5_text` | supported | supported |
201202
| `qwen35moe` | — | `qwen3_5_moe` | supported | supported |
202203
| `qwen3moe` | `qwen3_moe` | `qwen3_moe` | runtime deferred | supported |
204+
| `qwen3tts` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
203205
| `rnd1` | — | `llada` | runtime deferred | supported |
204206
| `rwkv6` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
205207
| `rwkv6qwen2` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
@@ -209,13 +211,72 @@ reason.
209211
| `starcoder2` | — | `starcoder2` | supported | supported |
210212
| `t5` | — | `t5` | runtime deferred | supported |
211213
| `t5encoder` | — | `t5encoder` | runtime deferred | supported |
214+
| `talkie` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
215+
| `wavtokenizer-dec` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
212216
<!-- END GGUF SUPPORT MATRIX -->
213217

214218
Canonical names are the strings llama.cpp writes into `general.architecture`,
215219
validated against a vendored census of the 147 architectures llama.cpp defines
216220
at commit `8d9af256337d1a501250f9bbf4c0859a654bddd6`. Aliases are spellings
217221
llama.cpp does not emit but that mobius still accepts.
218222

223+
### Audio/TTS/codec cohort
224+
225+
The four C09 architectures below were audited against llama.cpp commit
226+
`8d9af256337d1a501250f9bbf4c0859a654bddd6`. Their converter-produced primary
227+
tensor inventories are pinned in `llamacpp_pin.json`; being inventoried does not
228+
mean the graph is supported.
229+
230+
| Architecture | Exact component and I/O | Pinned closure | Verdict |
231+
|---|---|---:|---|
232+
| `pockettts` | Causal CALM backbone: conditioned token/latent rows plus KV state → hidden state. It has no semantic LM head. The required mmproj performs 24-kHz voice encoding, continuous 32-D flow generation at 12.5 Hz, EOS scoring, and stateful Mimi waveform decoding. | `3 + 10L` primary tensors (`243` for the 24-layer variant); no codebook tensors. | Deferred. Current standalone use is refused before graph construction because omitting `pockettts_spkenc` and `pockettts_gen` would expose the wrong contract. |
233+
| `qwen3tts` | Transformed causal talker: combined text+codec token IDs plus KV state → a 3072-row codec head shifted into the combined vocabulary. The required mmproj owns speaker conditioning, the remaining 15 codebooks, and stateful 24-kHz code-to-wave decoding. | `3 + 11L` primary tensors (`311` for the 28-layer 1.7B talker). | Deferred. Current standalone use is refused before graph construction; it is neither `Qwen3TTSForConditionalGeneration` nor `Qwen3TTSTokenizerV2Model`. |
234+
| `talkie` | Text token IDs plus KV state → text logits. This is not an audio model: it uses weight-free RMSNorm, post-RoPE Q/K normalization, query/attention/MLP gains, and an embedding skip in every block. | `2 + 9L` C++ loader-created tensors (`362` for 40 layers), plus `2L` converter-only `.scale` sidecars (`80`; emitted-file union `442`). | Deferred pending a dedicated graph, Q/K sign transform, exact gain-sidecar consumption, quantization guards, and independent logit/state/generation parity. |
235+
| `wavtokenizer-dec` | One non-causal 4096-entry code stream → `T × 1282` magnitude/phase parameters. The GGUF does **not** emit waveform audio; the missing processor must split 641-bin log-magnitude/phase and perform the exact 24-kHz, hop-320 ISTFT. No recurrent/cache state exists. | `161` tensors for the exact six-layer PosNet and 12-layer ConvNeXt graph. | Deferred. Current use is refused before graph construction until a dedicated feature-decoder task and exact ISTFT processor exist. |
236+
237+
The pinned loader/converter metadata contract is:
238+
239+
| Architecture | Required/operational metadata | Optional defaults and converter transforms |
240+
|---|---|---|
241+
| `pockettts` | `context_length`, `embedding_length`, `block_count`, `feed_forward_length`, `attention.head_count`, and `attention.layer_norm_epsilon`. | KV heads default to attention heads, causal attention defaults true, and RoPE base defaults to 10000. The converter derives dimensions from checkpoint tensor shapes, assumes head size 64, folds learned audio-BOS conditioning into `token_embd.weight`, and fixes the cache bound at 4096. |
242+
| `qwen3tts` | Generic decoder geometry, `attention.layer_norm_rms_epsilon`, and the required four-entry `rope.dimension_sections`. | `n_deepstack_layers` defaults to zero. The converter folds the text projection MLP into the text embedding rows, appends codec embeddings, offsets codec token IDs by text vocabulary size, writes the shifted EOS ID, and suppresses non-semantic codec rows. |
243+
| `talkie` | Generic decoder geometry, `attention.layer_norm_rms_epsilon`, and `logit_scale`. | KV heads default to attention heads, head lengths default to `embedding_length / head_count`, causal attention defaults true, and RoPE base defaults to 10000 (the released model writes 1000000). The converter applies Talkie's half-RoPE Q/K sign transform and emits `attn_output.scale`/`ffn_down.scale` from learned gains. Those 80 tensors are converter extras, not model-specific C++ creation sites. llama.cpp may tolerate them through generic weight-scale handling, but Mobius will not silently drop them: every Talkie import remains deferred until a graph explicitly consumes or rejects their exact semantics. |
244+
| `wavtokenizer-dec` | `context_length`, `embedding_length`, `features_length`, `block_count`, `feed_forward_length`, both PosNet/ConvNeXt widths and counts, layer-norm epsilon, group-norm epsilon/groups, and `vocab_size`. | `attention.causal=false`; no KV or recurrent state. Training-only codebook EMA tensors are intentionally excluded, but the single 4096×512 embedding codebook is required. |
245+
246+
`wavtokenizer-dec` deliberately overloads standard metadata. `features_length`
247+
is the 512-wide codebook feature input, `embedding_length` is the 1282-wide
248+
output (not the hidden width), and both `posnet.embedding_length` and
249+
`convnext.embedding_length` are the 768-wide hidden size. Exact files require
250+
`posnet.block_count=6`, `convnext.block_count=12`, matching hidden widths,
251+
non-causal centered kernel-3/kernel-7 convolutions, group-norm epsilon/groups,
252+
and `feed_forward_length=2304`. Treating `embedding_length` as the model hidden
253+
size is rejected as an ambiguous field interpretation.
254+
255+
Quantized linear matrices may only use a supported `MatMulNBits` path after
256+
their architecture-specific transforms. Convolution kernels, codebooks,
257+
normalization parameters, biases, gamma, and `.scale`/`.input_scale` sidecars
258+
must be dequantized or rejected; they are never silently routed through
259+
quantized MatMul or dropped. In particular, the pinned Qwen3-TTS and PocketTTS
260+
converters force convolution families to F16/F32 according to the llama.cpp
261+
consumer ABI, and WavTokenizer's available Q5_1 artifact needs float convolution
262+
handling. No C09 runtime is marked supported because no pinned artifact has
263+
independent reference waveform/feature or full-logit parity.
264+
265+
The smallest audited real files are in `ggml-org/WavTokenizer` at revision
266+
`0c97fdc098158ec9bf4e703cd5f81a5aa20520e6`:
267+
268+
| File | Size | LFS SHA-256 | Census |
269+
|---|---:|---|---|
270+
| `WavTokenizer-Large-75-F16.gguf` | 130,186,688 bytes | `2356baa8631cc2995ea3465196a017a2733600d849a91180c0f97fa7fb375bbe` | 161 tensors; float reference candidate |
271+
| `WavTokenizer-Large-75-Q5_1.gguf` | 73,319,616 bytes | `ad182c884841444ce6b70e8a61a7d084d9731320364dc633c9ef42632fc63d25` | Same graph; quantized matrix candidate |
272+
273+
That repository contains no independent processor/config bundle or reference
274+
feature/waveform vectors. The source WavTokenizer configuration supplies the
275+
24-kHz/75-Hz/hop-320 ISTFT semantics, but neither artifact has reproducible
276+
PyTorch↔llama.cpp↔ORT parity evidence; both therefore remain evidence candidates,
277+
not supported runtime fixtures. PocketTTS is gated, and the available Qwen3-TTS
278+
and Talkie checkpoints are not reasonably small cohort fixtures.
279+
219280
### Speculative draft GGUF contract
220281

221282
`dflash` and `eagle3` are auxiliary speculative-decoding models, never
@@ -482,6 +543,12 @@ An architecture outside this table is refused with a message naming its
482543
upstream cohort, so an unsupported input is never mistaken for a broken one.
483544
`clip` files are multimodal projector sidecars: pass them as
484545
`build_from_gguf(text_gguf, mmproj=...)` rather than on their own.
546+
For a Hub companion reference, Mobius range-reads only the bounded metadata
547+
header of the exact selected filename, verifies that file is `clip`, resolves
548+
the repository ref to an immutable commit, and downloads that same revision.
549+
Repository-level GGUF metadata is not used because mixed text+mmproj repositories
550+
describe the text architecture there. The downloaded local header is validated
551+
again before multimodal builder dispatch.
485552

486553
### Multimodal projector sidecars
487554

‎src/mobius/integrations/gguf/_arch_registry.py‎

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,46 @@
139139
"deferred until that evidence and an acceptance-loop integration exist."
140140
)
141141

142+
_POCKETTTS_BUNDLE_REASON = (
143+
"The primary GGUF is only PocketTTS's transformed causal CALM backbone: its "
144+
"embedding table contains folded learned conditioning rows and its duplicated "
145+
"embedding output is not a semantic LM head. Voice encoding, continuous 32-D flow "
146+
"generation, EOS scoring, and the stateful 24-kHz Mimi decoder live in a required "
147+
"pockettts_spkenc/pockettts_gen mmproj bundle that Mobius cannot import. Registering "
148+
"the backbone as text generation or TTS would expose the wrong I/O contract, so "
149+
"standalone conversion is refused before graph construction."
150+
)
151+
152+
_QWEN3TTS_BUNDLE_REASON = (
153+
"The primary GGUF is only a transformed Qwen3-TTS talker backbone, not the existing "
154+
"Mobius Qwen3TTS conditional-generation or codec model. The converter folds the text "
155+
"projection into an extended text+codec embedding table and emits a 3072-row codec "
156+
"head whose logits are shifted into that combined vocabulary. The required speaker "
157+
"encoder, 15-codebook predictor, and stateful 24-kHz code-to-wave decoder live in a "
158+
"qwen3tts_spkenc/qwen3tts_gen mmproj bundle that Mobius cannot import. Standalone "
159+
"conversion is therefore refused before graph construction."
160+
)
161+
162+
_TALKIE_GRAPH_REASON = (
163+
"Talkie is a text causal LM despite its upstream survey cohort. Its graph uses "
164+
"weight-free RMSNorm, post-RoPE Q/K normalization, learned attention and MLP gain "
165+
"sidecars, a per-head query gain, and an embedding skip in every block. No Mobius "
166+
"graph or tensor-value transform implements that combination, and no pinned real "
167+
"GGUF has passed independent full-logit, KV-state, and generation parity. Aliasing "
168+
"it to Llama or an audio task would build the wrong model."
169+
)
170+
171+
_WAVTOKENIZER_DEC_REASON = (
172+
"wavtokenizer-dec is a stateless non-causal code-token to ISTFT-parameter network, "
173+
"not a waveform codec decoder. Its metadata overloads features_length as the "
174+
"512-wide codebook feature input and embedding_length as the 1282-wide output, while "
175+
"768-wide PosNet and ConvNeXt stacks provide the hidden width. The GGUF graph stops "
176+
"before the required magnitude/phase reconstruction and ISTFT processor, so mapping "
177+
"it to CodecTask would falsely promise waveform output. Dedicated graph, processor, "
178+
"quantization guards, and independent F16/Q5_1 parity remain deferred; standalone "
179+
"runtime packaging is refused before graph construction."
180+
)
181+
142182
_ENCODER_GRAPH_MISMATCH = {
143183
"eurobert": (
144184
"EuroBERT uses pre-norm RMSNorm, RoPE, bias-free split Q/K/V attention, and a "
@@ -674,6 +714,39 @@
674714
"independent provenance and full hidden-state parity evidence."
675715
),
676716
),
717+
# ------------------------------------------------------ Audio / TTS / codec
718+
GGUFArchitectureSpec(
719+
gguf_arch="pockettts",
720+
config=Support.DEFERRED,
721+
tensor_map=Support.DEFERRED,
722+
graph=Support.DEFERRED,
723+
runtime=Support.DEFERRED,
724+
reason=_POCKETTTS_BUNDLE_REASON,
725+
),
726+
GGUFArchitectureSpec(
727+
gguf_arch="qwen3tts",
728+
config=Support.DEFERRED,
729+
tensor_map=Support.DEFERRED,
730+
graph=Support.DEFERRED,
731+
runtime=Support.DEFERRED,
732+
reason=_QWEN3TTS_BUNDLE_REASON,
733+
),
734+
GGUFArchitectureSpec(
735+
gguf_arch="talkie",
736+
config=Support.DEFERRED,
737+
tensor_map=Support.DEFERRED,
738+
graph=Support.DEFERRED,
739+
runtime=Support.DEFERRED,
740+
reason=_TALKIE_GRAPH_REASON,
741+
),
742+
GGUFArchitectureSpec(
743+
gguf_arch="wavtokenizer-dec",
744+
config=Support.DEFERRED,
745+
tensor_map=Support.DEFERRED,
746+
graph=Support.DEFERRED,
747+
runtime=Support.DEFERRED,
748+
reason=_WAVTOKENIZER_DEC_REASON,
749+
),
677750
GGUFArchitectureSpec(
678751
gguf_arch="arwkv7",
679752
config=Support.DEFERRED,

‎src/mobius/integrations/gguf/_arch_registry_test.py‎

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,99 @@ def test_deleting_recurrent_mapping_breaks_closure(
518518
_build_mapping.cache_clear()
519519

520520

521+
class TestPinnedAudioCohort:
522+
"""Pin the audited C09 inventories without implying graph support."""
523+
524+
_LAYER_COUNTS: ClassVar[dict[str, int]] = {
525+
"pockettts": 24,
526+
"qwen3tts": 28,
527+
"talkie": 40,
528+
# wavtokenizer's only {bid} family is the ConvNeXt stack. PosNet's
529+
# heterogeneous six-layer schedule is enumerated literally in the pin.
530+
"wavtokenizer-dec": 12,
531+
}
532+
_EXPECTED_COUNTS: ClassVar[dict[str, int]] = {
533+
"pockettts": 3 + 10 * 24,
534+
"qwen3tts": 3 + 11 * 28,
535+
"talkie": 2 + 9 * 40,
536+
"wavtokenizer-dec": 161,
537+
}
538+
539+
@classmethod
540+
def _expanded_patterns(cls, architecture: str, field: str) -> set[str]:
541+
names: set[str] = set()
542+
for pattern in getattr(upstream_architectures()[architecture], field):
543+
if "{bid}" in pattern:
544+
names.update(
545+
pattern.replace("{bid}", str(index))
546+
for index in range(cls._LAYER_COUNTS[architecture])
547+
)
548+
else:
549+
names.add(pattern)
550+
return names
551+
552+
@classmethod
553+
def _expanded_names(cls, architecture: str) -> set[str]:
554+
return cls._expanded_patterns(architecture, "tensor_names")
555+
556+
@pytest.mark.parametrize("architecture", sorted(_LAYER_COUNTS))
557+
def test_loader_inventory_is_suffix_exact_and_complete(self, architecture: str) -> None:
558+
names = self._expanded_names(architecture)
559+
assert len(names) == self._EXPECTED_COUNTS[architecture]
560+
assert all(name.endswith((".weight", ".bias")) for name in names)
561+
562+
def test_pockettts_inventory_has_no_semantic_output_head(self) -> None:
563+
names = self._expanded_names("pockettts")
564+
assert "token_embd.weight" in names
565+
assert "output.weight" not in names
566+
assert "blk.0.attn_q.bias" not in names
567+
568+
def test_qwen3tts_inventory_is_the_transformed_talker_only(self) -> None:
569+
names = self._expanded_names("qwen3tts")
570+
assert "output.weight" in names
571+
assert "blk.0.attn_q_norm.weight" in names
572+
assert not any(name.startswith("a.gen.") for name in names)
573+
574+
def test_talkie_loader_and_converter_closures_are_distinct(self) -> None:
575+
loader_names = self._expanded_names("talkie")
576+
converter_extras = self._expanded_patterns("talkie", "converter_extra_tensor_names")
577+
578+
assert len(loader_names) == 362
579+
assert len(converter_extras) == 80
580+
assert len(loader_names | converter_extras) == 442
581+
assert not loader_names & converter_extras
582+
assert "blk.0.attn_output.scale" in converter_extras
583+
assert "blk.0.ffn_down.scale" in converter_extras
584+
assert "blk.0.layer_output_scale.weight" in loader_names
585+
assert "blk.0.attn_output.input_scale" not in converter_extras
586+
587+
def test_wavtokenizer_heterogeneous_stacks_are_literal(self) -> None:
588+
names = self._expanded_names("wavtokenizer-dec")
589+
assert "posnet.2.attn_q.weight" in names
590+
assert "posnet.5.attn_norm.weight" in names
591+
assert "posnet.5.norm1.weight" not in names
592+
assert "convnext.11.gamma.weight" in names
593+
assert "convnext.12.gamma.weight" not in names
594+
595+
@pytest.mark.parametrize(
596+
"architecture",
597+
[
598+
"pockettts",
599+
"qwen3tts",
600+
"talkie",
601+
"wavtokenizer-dec",
602+
],
603+
)
604+
def test_task_misdispatch_is_refused(self, architecture: str) -> None:
605+
spec = try_get_arch_spec(architecture)
606+
assert spec is not None
607+
assert spec.model_type is None
608+
assert spec.graph is not Support.SUPPORTED
609+
assert all(verdict is Support.DEFERRED for verdict in spec.verdicts.values())
610+
with pytest.raises(UnsupportedGGUFArchitectureError):
611+
get_arch_spec(architecture)
612+
613+
521614
class TestRejectionsAreActionable:
522615
"""An unsupported input must say what it is and what to do instead."""
523616

0 commit comments

Comments
 (0)