Nodes/MiniMax H3 Context IR - leoleexh/MiniMax H3 Official Dialogue Tokenizer - leoleexh
ComfyUI Node

MiniMax H3 Official Dialogue Tokenizer - leoleexh

The tiny node that stops MiniMax H3 from mangling your dialogue

By leoleelxh·Created about a month ago·Updated 10 days ago· 3
MiniMax H3 Official Dialogue Tokenizer - leoleexh
  • clip
  • patched_clip
  • tokenizer_status_json

MiniMax H3 doesn't handle dialogue like other video models. Spoken lines are marked up with special tokens - you write (S1) says <d>[Chinese] 中文台词。</d> and the model treats everything inside <d>...</d> as literally spoken text. That's a genuinely nice system: it keeps speaker identity, voice, and delivery outside the tag while the words inside stay verbatim. But it only works if the tokenizer actually knows those tokens, with exactly the right IDs. If your H3 text-encoder loader ships a tokenizer without them, the tags become inert text and your dialogue comes out wrong - or the whole conditioning silently degrades.

M3H3OfficialDialogueTokenizer_leoleexh ("MiniMax H3 Official Dialogue Tokenizer - leoleexh") exists to close that gap. It's the smallest node in the ComfyUI-M3-IRContext pack and arguably the most important one for dialogue-heavy workflows: it patches the native H3 CLIP's tokenizer so the official special tokens exist, then verifies they're right.

How it works

The node expects the CLIP loaded from the native MiniMax H3 text encoder (the Qwen3-VL-32B one). It checks that the tokenizer is actually the H3 one - a generic Qwen or CLIP model gets an explicit error, not a shrug. Then it adds the official special-token set and confirms the critical IDs match: <d> must be 151669, </d> 151670, plus the cutoff, lyrics, and caption tokens (<|cutoff|> 151671, <|lyrics_start|> 151672, <|lyrics_end|> 151673, <|caption_start|> 151674, <|caption_end|> 151675). Finally it probes a real <d>[Chinese] 中文对白。</d> string to make sure it tokenizes correctly, and refuses to continue on any mismatch. If your loader already ships the right tokens, it reports already_ready and adds nothing - it's idempotent, so you can leave it in the graph permanently.

Wiring it in

Insert it between the H3 text encoder loader and the native H3 conditioning node:

H3 Text Encoder Loader.CLIP ──> Official Dialogue Tokenizer.clip
                                   └─> patched_clip ──> Native MiniMax H3.clip

The single input is clip (the H3 CLIP). Outputs are patched_clip (which becomes the clip feeding native H3 conditioning) and tokenizer_status_json, a JSON report of what was added and verified - handy for confirming a new loader version is already correct.

Why this matters in practice

If you're using the pack's Context IR node, dialogue is its whole selling point - it converts plain sentences like she says: Hello. English dialogue into the native <d> format automatically, and it validates that the output follows the (S1) says <d>[Language] 台词</d> structure. But generating that text is only half the job; it has to survive tokenization. This node is the "trust but verify" half. The Context IR node will tell you it produced dialogue; this node makes sure the conditioning pipeline can actually express it.

Install

It ships in the same pack, and the pack's only dependency is the OpenAI SDK - nothing heavy:

cd ComfyUI/custom_nodes
git clone https://github.com/leoleelxh/ComfyUI-M3-IRContext.git
python -m pip install -r ComfyUI-M3-IRContext/requirements.txt

Restart ComfyUI, find it under leoleexh/MiniMax H3. It needs no API key. The only real setup requirement is that you're running the native MiniMax H3 text encoder - which you are, if you're here. And a reminder that H3's own weights are license-geofenced out of the US, EU, UK, and South Korea, so make sure the model itself is legitimately available to you before building a workflow around it.

Categoryleoleexh/MiniMax H3

Inputs (1)

NameTypeDefaultDescription
clipCLIPCLIP loaded from the native MiniMax H3 Qwen3-VL-32B text encoder.

Outputs (2)

NameTypeDescription
patched_clipCLIP
tokenizer_status_jsonSTRING