Instructions to use MeiGen-AI/InfiniteTalk with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- InfiniteTalk
How to use MeiGen-AI/InfiniteTalk with InfiniteTalk:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
InfiniteTalk in ComfyUI crashes with cfg > 1 on large-VRAM cards (audio features not repeated for the batched CFG pass) - 11-line fix
Summary. With ComfyUI's built-in InfiniteTalk (MultiTalk) support, sampling with cfg > 1 crashes on a card with enough free memory. The cause is a batch-size mismatch in the audio cross-attention, and an 11-line change fixes it.
Setup where it happens
- ComfyUI v0.45.0 (commit 989d93d0d), built-in InfiniteTalk nodes, single speaker
- Wan 2.1 I2V 14B fp16 with the InfiniteTalk patch model, 81-frame windows
- cfg > 1 (full-quality sampling, 40 steps). The distilled / fast LoRA route at cfg 1 is not affected
- GPU: 96 GB (RTX PRO 6000). I'd expect any card with room to batch both passes to hit it
Cause. When there is enough VRAM, ComfyUI evaluates the conditional and unconditional passes together as one batch of two. audio_embeds in transformer_options covers a single sample: [1, N_t, tokens, C], squeezed to [N_t, tokens, C] inside. audio_cross_attn then reshapes for B * N_t frames with B = 2 and fails. On smaller cards ComfyUI runs the two passes one after the other, B is 1, and the bug never shows.
Fix. In comfy/ldm/wan/model_multitalk.py, in MultiTalkCrossAttnPatch, repeat the audio features once per batch item before the audio cross-attention:
audio_embeds = transformer_options.get("audio_embeds")
x_ref_attn_map = transformer_options.pop("x_ref_attn_map", None)
# With cfg > 1 and enough VRAM, the positive and negative passes run as one batch,
# but audio_embeds covers a single sample. Repeat it once per batch item so it becomes
# [B * N_t, tokens, C], in the same batch-major order as x.view(B * N_t, ...).
if x.shape[0] > 1:
if audio_embeds.dim() == 4 and audio_embeds.shape[0] == 1:
audio_embeds = audio_embeds.repeat(1, x.shape[0], 1, 1)
else:
audio_embeds = audio_embeds.repeat(x.shape[0], *([1] * (audio_embeds.dim() - 1)))
norm_x = self.model_patch.model.blocks[block_idx].norm_x(x)
Result. Full-quality lip-sync at cfg > 1 runs on the 96 GB cards. We used it for sung lip-sync from an isolated vocal stem.
Caveats
- This gives the unconditional pass the same audio features as the conditional one. That matched how the sequential (small-VRAM) path behaved for us, but I have not compared the two paths frame for frame.
- Tested on single-speaker InfiniteTalk only.
- Tested on v0.45.0 only. I have not checked whether a later ComfyUI release already fixes it.
Context: this came up while making a music video (Infectious, by Econ Myles, featuring the open character Claudia). Happy to share the full patch file.