Skip to content

Prevent incomplete hierarchical audio metadata exports - #537

Merged
justinchuby merged 26 commits into
mainfrom
justinchuby/minimax-music3
Aug 22, 2026
Merged

justinchuby merged 26 commits into
mainfrom
justinchuby/minimax-music3

Conversation

@justinchuby

@justinchuby justinchuby commented Aug 21, 2026 •

Copy link
Copy Markdown
Member

Summary

  • detect global-frame/local-codebook/flow/vocoder packages before generic diffusion dispatch and refuse incomplete ordinary-diffusion metadata
  • document the official local RVQ loop as stateless growing-length recomputation rather than inventing a second KV cache
  • support fully offline exports from pinned local diffusers/modular-pipeline checkouts, including local component configs, optional scheduler metadata, and sharded weights

The offline path is required for the 54 GB pinned checkpoint: it avoids mutable/repeated Hub lookups after provenance is fixed and enables H200 validation from the required catalogue directory.

Real checkpoint evidence

  • pinned HF revision: fbdf52fbaaca799592917417eb05f1899f1255ec
  • real LFS payload downloaded: 54 GB weights / 107 GB checkout
  • fp16 ONNX neural-component export completed: 27 GB at /datadisks/disk1/justinchu/inference-metadata-catalogue/minimax-music3/onnx-components-f16
  • representative source/export value check: model.layers.0.input_layernorm.weight max abs delta 2.98e-08, correlation 0.9999999999998486, identical L2 norm

This is real-weight export evidence, not L4/L5 runtime evidence. No package has been published.

Validation

  • python3 -m pytest src/mobius/integrations/diffusers/_builder_test.py -q --tb=short (37 passed)
  • graph-only build of all 11 Music3 ONNX artifacts from the local pinned checkout
  • full fp16 weighted export completed successfully

Part of #504. Canonical nested workflow emission remains the next producer commit; the guard intentionally stays fail-closed until that executable workflow exists.

Detect global-frame/local-codebook audio generation packages before generic diffusion dispatch. Fail with the exact missing canonical workflow contracts so component exports cannot be mislabeled as executable runtime packages.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
@justinchuby
justinchuby requested review from a team and a lite review from Copilot August 21, 2026 23:20
@github-actions

github-actions Bot commented Aug 21, 2026 •

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing c97035c → a49c3a3

Model Sub-model Changes Status
bert (feature-extraction) model 0 ⚪
falcon model 0 ⚪
gemma2 model 0 ⚪
gemma4 (gemma4) decoder 0 ⚪
gemma4 (gemma4) embedding 0 ⚪
gemma4 (gemma4) vision_encoder 0 ⚪
gemma4_text model 0 ⚪
gpt2 model 0 ⚪
llama model 0 ⚪
llama (static-cache) model 0 ⚪
mamba (ssm-text-generation) model 0 ⚪
phi3 model 0 ⚪
phi3 (static-cache) model 0 ⚪
qwen model 0 ⚪
qwen (static-cache) model 0 ⚪
qwen2 model 0 ⚪
qwen2 (static-cache) model 0 ⚪
qwen2_moe model 0 ⚪
qwen2_moe (static-cache) model 0 ⚪
qwen3 model 0 ⚪
qwen3 (static-cache) model 0 ⚪
qwen3_5_moe (hybrid-text-generation) model 0 ⚪
qwen3_5_text (hybrid-text-generation) model 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) decoder 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) embedding 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) vision_encoder 0 ⚪
qwen3_moe model 0 ⚪
qwen3_moe (static-cache) model 0 ⚪
qwen3_next (hybrid-text-generation) model 0 ⚪
t5 (seq2seq) decoder 0 ⚪
t5 (seq2seq) encoder 0 ⚪
whisper (speech-to-text) decoder 0 ⚪
whisper (speech-to-text) encoder 0 ⚪

No architecture changes detected. ✅


Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed)

@justinchuby justinchuby mentioned this pull request Aug 21, 2026
4 of 10 tasks
@github-actions

github-actions Bot commented Aug 21, 2026 •

Copy link
Copy Markdown

Performance Comparison

Comparing c97035c → a49c3a3

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0% ⚪
bert (feature-extraction) num_nodes 68 68 +0.0% ⚪
falcon model_size_bytes 364 KB 364 KB +0.0% ⚪
falcon num_nodes 66 66 +0.0% ⚪
gemma2 model_size_bytes 428 KB 428 KB +0.0% ⚪
gemma2 num_nodes 105 105 +0.0% ⚪
gpt2 model_size_bytes 388 KB 388 KB +0.0% ⚪
gpt2 num_nodes 54 54 +0.0% ⚪
llama model_size_bytes 425 KB 425 KB +0.0% ⚪
llama num_nodes 60 60 +0.0% ⚪
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
llama (static-cache) num_nodes 56 56 +0.0% ⚪
mamba (ssm-text-generation) model_size_bytes 296 KB 296 KB +0.0% ⚪
mamba (ssm-text-generation) num_nodes 94 94 +0.0% ⚪
phi3 model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 num_nodes 58 58 +0.0% ⚪
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 (static-cache) num_nodes 54 54 +0.0% ⚪
qwen2 model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 num_nodes 60 60 +0.0% ⚪
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 (static-cache) num_nodes 56 56 +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) model_size_bytes 506 KB 506 KB +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) num_nodes 264 264 +0.0% ⚪
qwen3_5_text (hybrid-text-generation) model_size_bytes 458 KB 458 KB +0.0% ⚪
qwen3_5_text (hybrid-text-generation) num_nodes 126 126 +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) model_size_bytes 977 KB 977 KB +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) num_nodes 428 428 +0.0% ⚪
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0% ⚪
t5 (seq2seq) num_nodes 176 176 +0.0% ⚪
whisper (speech-to-text) model_size_bytes 1008 KB 1008 KB +0.0% ⚪
whisper (speech-to-text) num_nodes 128 128 +0.0% ⚪

No performance regressions.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a fail-closed guard in the ONNX GenAI auto-export dispatch logic to prevent hierarchical audio-generation packages (global-frame AR + local RVQ + flow + vocoder) from being incorrectly treated as a generic diffusion pipeline and exported with incomplete/inaccurate runtime metadata.

Changes:

  • Add a structural detector for hierarchical audio generation package topology that must take precedence over generic diffusion detection.
  • Refuse to emit ONNX GenAI metadata for these packages until a canonical workflow can be represented (raises NotImplementedError with a detailed message).
  • Add a regression test ensuring hierarchical audio packages are not misclassified as diffusion.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/mobius/integrations/onnx_genai/auto_export.py Adds hierarchical-audio topology detection and fail-closed dispatch before diffusion metadata emission.
src/mobius/integrations/onnx_genai/auto_export_test.py Adds a unit test asserting hierarchical audio packages raise a precise NotImplementedError instead of dispatching as diffusion.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

justinchuby and others added 6 commits August 22, 2026 00:10
Resolve modular pipeline indexes, component configs, optional metadata, and weight shards directly from a pinned local checkout. This makes large checkpoint exports reproducible without re-querying the Hub and preserves external component resolution when no local subfolder exists.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
Construct graph-backed placeholder components so the hierarchical package regression respects ModelPackage validation on every supported Python version.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
Replace the fail-closed hierarchical-audio dispatch with graph-derived canonical metadata covering two-row Global decoding, stateless seven-codebook RVQ recomputation, one Global KV service group, warmup/stop/frame-cap semantics, hidden fusion, 200/100 chunking, 172-latent overlap carry, 30-step flow matching, vocoder stitching, and buffered 44.1-to-32 kHz audio delivery. Add reusable policy graphs and exact text-assembly assets with focused runtime tests.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
Mark the Global KV cache as two contiguous classifier-free-guidance rows per request so canonical metadata remains truthful while allowing runtime-owned cache compaction.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
Keep the gathered stop logit rank-two before concatenating it with semantic candidates, and execute the policy under ORT in regression coverage.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
Keep split embedding outputs aligned with decoder precision, describe dynamic workflow state truthfully, and evaluate Snake reciprocals in float32 so fp16 CUDA vocoder execution remains finite.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
@justinchuby

Copy link
Copy Markdown
Member Author

Executable real-weight update (commit 95c3278a):

  • Fixed split embedding dtype contracts and dynamic canonical state recurrence.
  • Root-caused CUDA-silent WAVs to fp16 Snake reciprocal overflow: checkpoint alpha reaches -4.768e-06, so fp16 reciprocal became infinity and vocoder output NaN. Snake now evaluates in fp32.
  • Targeted tests: 46 passed; Ruff clean.
  • Official pinned diffusers vocoder L4 (dafe3733fcfdbf3c48915fe77be3aef65b5d6a2d): max_abs 6.339e-4, mean_abs 8.815e-5, finite, allclose atol/rtol 2e-2.
  • Real H200 /v1/audio/speech, stream=false: HTTP 200, 3.99384 s, 32 kHz stereo PCM16 WAV, RMS 0.12067, 99.968% nonzero, 5.8697 s buffered latency, 17.04 acoustic units/s, peak 43,117 MiB VRAM.
  • Evidence WAV: /datadisks/disk1/justinchu/inference-metadata-catalogue/minimax-music3/l5_music3_h200.wav.

Private package upload is in progress under justinchuby/onnx-genai-example-minimax-music3 (28,591,285,801 bytes).

@justinchuby

Copy link
Copy Markdown
Member Author

Final package: https://huggingface.co/justinchuby/onnx-genai-example-minimax-music3 (private), revision 0c56f77d85f46f935153b5b492ce90a8a053c59b, 28,591,806,806 bytes. It includes the real L4 evidence and 3.99 s L5 WAV. The final local package also passes validate_metadata. Catalogue commit: a04f32d3b827111f06b2e486a72b09986933157f.

justinchuby and others added 3 commits August 22, 2026 05:45
Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
Generate a deterministic no-network nested audio package, declare CFG-expanded Global rows correctly, and align image and shared-state metadata with canonical validation.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
Bring files merged from main into compliance with the pinned Ruff checks that run against the PR merge history.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
State-service aliases describe updating past/present pairs; shared-state denoiser readers remain ordinary workflow inputs and no longer emit the retired access field.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
@justinchuby

Copy link
Copy Markdown
Member Author

Updated open PR at 3b73190bc352bf0794c6badfe2383c559506ca77 (not merged). Latest main was merged without rebasing; conflicts, lint, and test regressions are fixed.

The branch now emits CFG-expanded Global contracts correctly, canonical image ranges/read-only state aliases, and a deterministic no-network hierarchical-audio package that executes the nested Global/RVQ/30-step-flow/vocoder path in ONNX GenAI producer CI. All completed checks pass; only the queued Integration (fast) lane remains.

Persist policy graphs registered during hierarchical-audio metadata generation and regress the normal save-before-metadata CLI order. Execute the generated nested audio workflow with a pinned ONNX GenAI runtime in Mobius CI, including CFG row collapse, finite stereo output, and request-state reset checks.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
@justinchuby

Copy link
Copy Markdown
Member Author

@copilot merge from main.

Integrate current workflow metadata, policy component, and validation updates while preserving the hierarchical audio producer contracts.

Signed-off-by: GitHub <[email protected]>

Co-authored-by: justinchuby <[email protected]>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ justinchuby
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

Signed-off-by: Justin Chu <[email protected]>
build_waveform_stitch(
dtype=next(iter(pkg["vocoder"].graph.outputs)).dtype,
latent_hop_length=512,
crop_left_latents=86,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these different across models? Can they be encoded in modeling code?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved in 2b54205 (latest head ec48bbe): hierarchical metadata now reads model-varying execution values from a pinned, provenance-bearing workflow contract; component roles are resolved structurally from the package config, tensor geometry/vocabulary bounds/audio dimensions are validated from graphs and component configs, tokenizer sentinel IDs are resolved from tokenizer.json, and missing facts fail closed. Two materially different synthetic configurations verify emitted dimensions/tokens/steps/audio contracts vary without Music3 constants leaking.

Copilot AI commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

@copilot merge from main.

Merged latest main in 3fe54b1.

justinchuby and others added 12 commits August 22, 2026 16:07
Derive component roles and tensor geometry from package graphs, require a validated pinned workflow contract for execution-only values, and add variant/fail-closed producer coverage. Restore runtime conformance CI and refresh generated fixtures.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
Bring the branch up to date with current main before final review while preserving generalized hierarchical-audio metadata and conformance coverage.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
Validate the requested runtime before creating output artifacts or opening the GGUF file, matching the CLI contract on every supported platform and Python version.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
Derive the semantic boundary from the complete tokenizer vocabulary, fail closed on inconsistent token or graph ranges, source guidance-row splice values from the pinned workflow contract, and exercise raw speech text assembly through the HTTP API in producer conformance.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
Fail closed in the direct metadata writer when stop or unconditional token IDs are negative, overlap the semantic range, or exceed the ONNX logits vocabulary. Cover direct and auto-export paths and verify no metadata, processor, or policy artifacts are emitted.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
Resolve policy-component and workflow detector conflicts while preserving direct hierarchical-audio token validation and current video diffusion dispatch.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Address the architectural review of the hierarchical-audio (MiniMax Music3)
metadata support so mobius owns only model-agnostic Python producer code and
downstream runtime conformance stays in ONNX GenAI.

What changed and why:

- Remove ONNX GenAI runtime tests from mobius. Delete
  tests/onnx_genai_speech_conformance.rs and revert the Music3/hierarchical
  additions to tests/onnx_genai_workflow_conformance.rs. Rust/HTTP end-to-end
  conformance belongs to onnxruntime-genai, not the mobius producer.

- Delete the model-specific "producer contract"
  src/mobius/integrations/diffusers/workflow_contracts/hierarchical_audio_flow_v1.json
  and its pyproject package-data registration. It encoded MiniMax constants
  (vocab 16384, guidance scales, flow_steps=30, 32kHz, prompt literals) as a
  hidden generic default, which it is not.

- Introduce a typed, model-agnostic HierarchicalAudioWorkflowConfig dataclass
  that carries exactly the runtime facts a hierarchical-audio pipeline cannot
  derive from its neural graphs (semantic-vocabulary boundary, CFG schedule,
  chunked flow plan, prompt-assembly template). It ships no defaults, names no
  model, and self-validates on construction (fails closed). The metadata
  producer consumes this config only, keeps the two control-token bounds
  (nonnegative, below semantic_vocabulary_start, below the graph's global
  logits width) as writer authority against the built graph, and emits no
  artifact or policy component before all validation passes.

- Resolve the config in build_diffusers_pipeline from an explicit caller
  argument or a pinned source-model asset (mobius_workflow.json at the
  requested revision), never by pipeline/model/class name. Structural role
  extraction still recognizes MiniMax component classes to wire the graphs,
  but the generator branches only on structural roles and graph/config fields.
  When no config is available the graphs still build and the package is marked
  workflow_kind="hierarchical_audio" so ONNX GenAI metadata emission fails
  closed with an instruction to supply the config instead of misclassifying
  the package as diffusion.

- Replace the contract-file tests with Python tests that construct explicit
  HierarchicalAudioWorkflowConfig values and prove emitted policy/template
  fields follow the input, plus a mocked source-asset loader test and an
  auto_export fail-closed test. Keep the tokenizer/graph-derived validation
  and the save-policy-artifact assertions.

- Drop the unrelated SenseNova pixel-flow denoiser cache-alias edits from this
  PR (revert shared_state_flow_metadata.py and sensenova_u1_test.py to main);
  regenerate the shared_state_pixel_flow fixture so only the required 3D-latent
  row_shape change remains.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
Merging latest main brought in a `yarn_apply_mscale` helper whose signature
line exceeds the 95-character limit and was committed without running ruff
format, leaving the repo's Lint (lintrunner --all-files) red. Wrap the
signature so `ruff format` is clean across the whole tree.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
The hierarchical-audio workflow config (semantic-token boundary, guidance
schedule, chunked flow plan, prompt template) carries runtime facts that
cannot be read back from the exported neural graphs. Previously the builder
required these to arrive from an explicit caller argument or an external
`mobius_workflow.json` source-model asset, else it failed closed -- too
strict, since mobius is the canonical model-name -> model-information
registry and already owns MiniMax token constants here.

Move the Music 3 defaults into the diffusers config-adapter layer, following
the existing `from_diffusers` prior art:

- Add named `MINIMAX_MUSIC3_*` workflow defaults + a `MiniMaxMusic3WorkflowConfig`
  adapter in `_configs.py`. Its `from_diffusers` builds the typed, generic
  `HierarchicalAudioWorkflowConfig` from source component configs (the global
  decoder's context window) plus the mobius-owned defaults, with provenance
  comments. A divergent checkpoint overrides any field.
- Select the adapter by pipeline class in the builder via a small
  `_resolve_hierarchical_workflow_config` helper: an explicit `workflow_config`
  argument always wins; otherwise mobius supplies the adapter defaults; an
  unrecognised hierarchical topology still fails closed (marked so ONNX GenAI
  metadata emission stops with an instruction). Remove the
  `mobius_workflow.json` asset loader and `HIERARCHICAL_AUDIO_WORKFLOW_ASSET`.
- Keep the generic metadata writer fully model-agnostic: zero model-name/class
  checks and no MiniMax literals; it validates normalized fields and the two
  token ids against the graph's global logits width.
- Drive the checked-in hierarchical_audio validation fixture through the new
  adapter (byte-identical output), and add adapter/resolution tests proving
  default ownership, context-window generalization, explicit-argument override,
  and fail-closed behavior for unknown pipelines.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
@justinchuby
justinchuby merged commit cbf4cbd into main Aug 22, 2026
20 of 24 checks passed
@justinchuby
justinchuby deleted the justinchuby/minimax-music3 branch August 22, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants