Fix MiniMax Music 3 producing noise with CUDA graphs enabled. (#16428)

The AR decode loop captured the per-layer graphs without decode buffers, so
Llama2_ fell back to x = x.clone() and every replay read the address of the
first step after it had been freed. The output was garbage audio codes with no
error: the decoded track is NaN, saved as a constant -32768 by the FLAC encoder.

YuE2 and the generic generate() already pin the hidden state and rotary tensors
through decode_buffers; do the same here, gated the way generate() gates it.

Fixes #16002 (the silent-noise report) and #16222.
This commit is contained in:
Raynold van Heyningen
2026-09-20 11:02:00 -04:00
committed by GitHub
parent 3dd559d81f
commit 99073836d4
+4 -1
View File
@@ -261,6 +261,9 @@ class MiniMaxMusic3AR(nn.Module):
generator = torch.Generator(device=device).manual_seed(derive_seed(seed, "ar"))
decoder = self.model.audio_decoder
decode_buffers = None
if self.model.graph_dynamic_vbar_blocks and comfy.model_prefetch.malloc_graph_enabled(device) and not comfy.model_management.args.disable_cuda_graphs:
decode_buffers = self.model.init_decode_buffers(last_hidden.shape[0], device, execution_dtype)
depth_io = {
"hidden": torch.empty_like(last_hidden),
"c0": torch.empty((last_hidden.shape[0],), dtype=torch.long, device=device),
@@ -338,7 +341,7 @@ class MiniMaxMusic3AR(nn.Module):
pending_hidden_valid = True
feedback = self._embed_audio_frame(feedback_codes, execution_dtype)
output = self.model(None, embeds=feedback, past_key_values=past, dtype=execution_dtype)
output = self.model(None, embeds=feedback, past_key_values=past, dtype=execution_dtype, decode_buffers=decode_buffers)
last_hidden.copy_(output[0][:, -1])
past = output[2]
del output, feedback, frame_hidden, depth_hidden, feedback_codes, c0_embed, c0, code_or_stop