{"record":{"id":"7ea0649247406b83","repo":"Comfy-Org/ComfyUI","slug":"minimax-h3-supports-batch-size-1","errorCode":null,"errorMessage":"MiniMax H3 supports batch size 1","messagePattern":"MiniMax H3 supports batch size 1","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/ldm/minimax/model.py","lineNumber":539,"sourceCode":"\n        out = comfy.patcher_extension.WrapperExecutor.new_class_executor(\n            self._forward,\n            self,\n            comfy.patcher_extension.get_all_wrappers(comfy.patcher_extension.WrappersMP.DIFFUSION_MODEL, transformer_options)\n        ).execute(x, timestep, context, transformer_options, minimax_payload=minimax_payload, **kwargs)\n\n        if scale != 1.0:\n            # d/d(sigma_v) of the carried variable\n            out[1] = ((1.0 - scale) * (audio_src * carry)\n                      + (1.0 + (scale - 1.0) * sigma_a).to(out[1].dtype) * out[1])\n        return out\n\n    def _forward(self, x, timestep, context, transformer_options={}, minimax_payload=None, **kwargs):\n        video_x, audio_x = x[0], x[1]\n        orig_t, orig_h, orig_w = video_x.shape[2], video_x.shape[3], video_x.shape[4]\n        video_x = comfy.ldm.common_dit.pad_to_patch_size(video_x, self.patch_size)\n        if video_x.shape[0] != 1:\n            raise ValueError(\"MiniMax H3 supports batch size 1\")\n        payload = minimax_payload or {}\n        device = video_x.device\n        dtype = context.dtype  # compute dtype\n\n        latent_t, lat_h, lat_w = video_x.shape[2], video_x.shape[3], video_x.shape[4]\n        audio_t = audio_x.shape[-1]\n        text_len = context.shape[1]\n        # extra_conds prebuilds the layout once per sampling run\n        layout = payload.get(\"layout\")\n        if layout is None or layout.signature != (text_len, latent_t, lat_h, lat_w, audio_t):\n            layout = PackedLayout(text_len, latent_t, lat_h, lat_w, audio_t,\n                                  keyframes=payload.get(\"keyframes\"),\n                                  refs=payload.get(\"refs\"))\n\n        # model_base passes model_sampling.timestep(sigma) = sigma * 1000\n        shift_v = float(transformer_options.get(\"minimax_h3_sigma_shift_video\", self.sigma_shift_video))\n        shift_a = float(transformer_options.get(\"minimax_h3_sigma_shift_audio\", self.sigma_shift_audio))\n        sigma_v = (timestep.flatten()[0] / 1000.0).float().clamp(min=1e-6)","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ldm/minimax/model.py#L521-L557","documentation":"Raised in MiniMax H3's _forward when the video latent batch dimension is not 1. The model packs video and audio latents into a single PackedLayout keyed by (text_len, latent_t, lat_h, lat_w, audio_t) and its layout/attention code assumes exactly one sequence, so batching is not implemented. Any batched prompt fails fast with this ValueError.","triggerScenarios":"Calling the MiniMax H3 diffusion model's forward with video_x.shape[0] != 1 — e.g. batch size 2+, or accidentally leaving a batch dimension of size >1 after splitting/merging latents in a workflow.","commonSituations":"Setting batch_size > 1 in a ComfyUI workflow that includes the MiniMax H3 node; batching prompts for throughput; a latent-broadcast operation silently expanding the batch dim before the model call.","solutions":["Set batch size to 1 for MiniMax H3 runs","Loop over prompts sequentially instead of batching","Check the workflow for nodes between the sampler and the model that expand the latent batch dimension"],"exampleFix":"# before\nvideo_latent = video_latent.repeat(2, 1, 1, 1, 1)  # batch of 2\nout = model((video_latent, audio_latent), t, ctx)\n# after\nvideo_latent = video_latent[0:1]  # batch of 1\nout = model((video_latent, audio_latent), t, ctx)","handlingStrategy":"validation","validationCode":"assert video_latent.shape[0] == 1, f'MiniMax H3 requires batch size 1, got {video_latent.shape[0]}'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check latent batch dims right after any node that could broadcast/repeat latents","Keep MiniMax H3 workflows at batch_size 1 and loop externally for multiple prompts"],"tags":["minimax","video","batch-size","latent"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}