Nodes/ComfyUI-Fantastic-MiniMaxH3-PromptBuilder/Fantastic H3 RefMod Text Encode
ComfyUI Node

Fantastic H3 RefMod Text Encode

The Reference to Video node, but it knows your saved references

By Adudeguyman·Created about a month ago·Updated about 18 hours ago· 151
Fantastic H3 RefMod Text Encode
  • clip
  • mods
  • references
  • vae
  • audio_vae
  • conditioning
  • reference_map
  • latent
prompt
width1344
height768
length124
ref_image_sizematch
reference_fps24.00
max_total_tokens0

Why this exists

MiniMax H3 doesn't read references the way a photo prompt does. It's an omni-modal model - text, image, video and audio are one input context - and in reference mode you cite media by name in the prompt (<Picture 1>, <Video 1>, <Audio 1>) while the actual tensors ride alongside the conditioning. The native MiniMax H3 Reference to Video node does that job. It has no idea what a RefMod is, though - a RefMod is already an encoded latent, not a file on disk, so there's nothing for the native node to load.

This node is the drop-in replacement. Same role, same settings, plus RefMods. Use it or the native node, not both.

How it works

H3's tokenizer accepts reference items inline, so the prompt text and the media are presented together and the labels in your writing resolve to specific tensors. This node builds that item list in a fixed order: the Media Loader's media first (from references), then the RefMod bundle (from mods), with one counter per kind - images, videos, audio each numbered separately.

Visual RefMods get decoded back through the H3 video VAE first. It's deliberate: it means the text encoder is shown the same content the diffusion model receives, including any softening a weight below 1 applied. Loader video is presented at H3's native 2 fps timestamps, derived from reference_fps.

The outputs are the payoff. conditioning leaves with the reference blocks already attached (minimax_refs), so you wire it straight to your sampler or guider. latent is H3's own empty AV latent, sized from width/height/length - no separate Empty Latent node needed. And reference_map is a plain text listing of every label and where it came from, which is the honest answer to "so which one is <Picture 3>?"

Inputs and outputs that matter

  • clip - the H3 CLIP. It checks, and tells you plainly if it isn't one.
  • prompt - from the Prompt Builder, or typed by hand.
  • width / height / length - the same settings the native node has, and they mean the same thing. length steps in 17s because H3 stores frames that way; 124 is about five seconds at 24 fps, and media reference videos are cut to it.
  • ref_image_size - match scales each media picture down to your generation's pixel area; max keeps up to a 2048 px short edge for identity work, at a real cost in speed. RefMods keep whatever size they were saved at either way.
  • reference_fps - playback rate assumed when a RefMod's frames are reconstructed as video. Compressed or stacked references don't keep their original timing, so you control how fast they move.
  • Optional: mods, references, vae, audio_vae.
  • Outputs: conditioning, reference_map, latent.

Install

Search Fantastic H3 Prompt Builder in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/Adudeguyman/ComfyUI-Fantastic-MiniMaxH3-PromptBuilder

Restart ComfyUI completely. You need ComfyUI 0.30.0+ (this is when H3 landed), the H3 checkpoints, and the H3 video VAE for pictures and clips. Voices need the H3 audio VAE. Use a ref2va checkpoint here - that's the one trained on references - and note the community's caveat that the open ref2va weights have known faults, so an fl2va/ref2va hybrid is the better testbed. The pack's only dependency is av.

One thing that has nothing to do with this pack but everything to do with whether you can use it: the H3 open weights are under MiniMax's community licence, whose grant excludes the US, EU, UK and South Korea - outputs included.

Where people get burned

You don't stack it with Apply. The conditioning from this node already carries the references. Wire the same bundle into RefMod Apply as well and the model gets two copies - more tokens, slower sampling, no benefit.

Errors here are unusually readable: an old ComfyUI gets "This ComfyUI has no native MiniMax H3 support; update it", a non-H3 CLIP gets "Connect an H3 CLIP", and visuals without a VAE get told to connect the H3 video VAE (it also checks the VAE is actually the H3 one, since silently accepting the wrong VAE would be worse). Audio-only references don't need the video VAE at all; if loader audio arrives without an audio VAE, you get a console note that it's conditioning the text encoder only, not a crash.

Expect a pause before sampling starts on a big stack - decoding visual RefMods for the encoder takes seconds per entry.

And the numbering rule that catches everyone: H3 labels by arrival order, not by which slot you plugged into. Gaps close. Loader media is numbered before RefMods. Read reference_map or the Prompt Builder's chips rather than trusting intuition - rewrite <Video 2> by hand and you may be describing the wrong reference entirely.

Categoryconditioning/video_models

Inputs (12)

NameTypeDefaultDescription
clipCLIP
promptSTRING
widthINT134432–16384Generation width: sizes the empty latent and, with 'match', the media references.
heightINT76832–16384
lengthINT1245–3600Frame count at 24 fps (124 = ~5 s). Media reference videos are cut to it.
ref_image_sizeCOMBOmatchMedia pictures: 'match' scales each (down only) to the generation's pixel area; 'max' keeps up to a 2048 px short edge for identity, at a cost in speed. RefMods keep the size they were saved at.
reference_fpsFLOAT24.001–120Playback rate assumed for a reconstructed RefMod video. Compressed or stacked references do not keep their original timing.
max_total_tokensINT00–2147483647Refuse RefMod bundles over this many reference tokens. 0 = no limit.
modsoptH3_REF_MODSRefMod bundle from a RefMod Stack or the Prompt Builder's mods output.
referencesoptH3_REFSMedia Loader bundle — from the loader, or the Prompt Builder's references output. Labelled before the RefMods.
vaeoptVAEH3 video VAE: encodes media pictures and clips, and reconstructs visual RefMods for the encoder. Not needed for audio-only references.
audio_vaeoptVAEH3 audio VAE: encodes media voices and soundtracks. RefMod voices are already encoded.

Outputs (3)

NameTypeDescription
conditioningCONDITIONING
reference_mapSTRING
latentLATENT