From 99073836d45f66053c45ba8564984e6def9cebba Mon Sep 17 00:00:00 2001 From: Raynold van Heyningen Date: Sun, 20 Sep 2026 17:02:00 +0200 Subject: [PATCH] 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. --- comfy/ldm/minimax_music/ar.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/comfy/ldm/minimax_music/ar.py b/comfy/ldm/minimax_music/ar.py index 30b556a49..2a702c527 100644 --- a/comfy/ldm/minimax_music/ar.py +++ b/comfy/ldm/minimax_music/ar.py @@ -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