Repository navigation
Add Magenta RealTime 2 Small and Base with streaming generation - #1121
Merged
Merged
Conversation
0xShug0
added a commit
that referenced
this pull request
Nov 1, 2026
…the missing WebUI catalog entry (#1158) * fix(magenta_realtime_2): accept legacy duration_seconds request option The server forwards the top-level duration_seconds field verbatim, and the WebUI gen path sends that legacy field to every family except controlfoley and midashenglm_gen. Magenta RealTime 2 validated raw option keys against its schema-v1 contract before parsing, so GUI music requests failed with "unknown Magenta RealTime 2 request option: duration_seconds". Normalize legacy request names with apply_option_v1_compatibility before the whitelist check, as stable_audio and heartmula already do, and parse all options from the normalized map. Sending both spellings still fails with the explicit use-duration_sec error. * fix(webui): add the missing Magenta RealTime 2 catalog entry PR #1121 added the family everywhere except models_catalog.json, so a Magenta RealTime 2 model configured through the server config found no catalog base and its GUI entry carried no request_options metadata. With that metadata missing, supportsMaxTokens fell back to the task-based assumption and sent max_tokens with every gen request, which magenta's strict schema-v1 whitelist rejected with "unknown Magenta RealTime 2 request option: max_tokens". Add the catalog entry following the other music-gen families, and regenerate the embedded dist bundle. Config-defined magenta entries now match the catalog by family and task, get their request options from the family spec, and no longer send max_tokens. * Use canonical duration option in WebUI requests --------- Co-authored-by: 0xShug0 <[email protected]>
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.
Adds Magenta RealTime 2 Small (230M) and Base (2.4B) for 48 kHz stereo instrumental music generation through the
genroute, with offline and streaming modes.Packages: audio-cpp/Magenta-RealTime-2-GGUF. Inference requires no Python, JAX, or TensorFlow Lite.
CUDA performance
RTX 5090, CUDA, eight host threads, one persistent session per model. After a
two-second warmup, generate three different 30-second styles and repeat the
first style. Both implementations use temperature 1.3, top-k 40, style guidance
3, note/drum guidance 1, the text mapper enabled, and seed 0.
Warm RTF averages the four measured requests, including style conditioning and
waveform generation. RTF is wall time divided by audio duration. Peak VRAM
includes model preparation and generation. Python uses its official
generate()path; every row measures complete waveform generation.
Streaming time to first audio
Under the same CUDA settings, TTFA includes text conditioning through the first
160 ms audio block and excludes model loading and preparation. Warm averages
cover the four requests after warmup.
Validation
Debug build, eight host threads, sequential runs.
Vulkan and CPU end-to-end smoke tests
One Small Q8_0 streaming request per backend, no warmup: “A gentle acoustic guitar with warm piano”, eight seconds, seed 0, other options at their defaults. Vulkan uses the RTX 5090; CPU uses a Ryzen 9 7900X with eight threads.
Both produce finite, non-silent 48 kHz stereo audio and 50 streaming events that concatenate exactly to the final WAV. Cold RTF and TTFA include request-time graph initialization and conditioning, excluding model loading/preparation. These are functional smoke tests; cross-backend sampled-waveform parity was not required.
Metal fix and performance
SpectroStream activations exceed FP16 range, causing NaNs when Metal's default F32-buffer matmul internally narrows its operands to FP16. Add an explicit full-F32-input Metal specialization and enable it only for this codec on Metal. Default pipelines and other backend paths retain their existing behavior.
Apple M4 Pro, Release, eight host threads, Small Q8_0: the same eight-second streaming smoke request completes in 4.754 s, with RTF 0.594 and TTFA 205 ms, excluding model loading/preparation. Output is finite, non-silent 48 kHz stereo; offline and streaming WAVs are byte-identical. This is a functional measurement, not a speedup comparison against the invalid pre-fix output.
All 56 extended Metal matmul cases pass against independent scalar double-precision calculations. Default F32/F16/Q8_0 before/after outputs remain byte-identical. Tensor-enabled Metal shader compilation also passes; GPU execution was validated on M4 Pro.