Nodes/XB_ToolBox/XB-BOX - 📝 Wan T5 加载器(FP8)
ComfyUI Node

XB-BOX - 📝 Wan T5 加载器(FP8)

The Wan T5 loader that reads umt5-xxl, not CLIP

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB-BOX - 📝 Wan T5 加载器(FP8)
    • t5_model
    model_name
    precisionbf16
    load_deviceoffload_device
    quantizationdisabled

    Wan 2.1 and 2.2 don't use a CLIP text encoder for prompts - they use a UM-T5 encoder, which is a much bigger multilingual transformer. If you're building an XB-BOX Wan workflow, this is the node that loads it: it picks a file out of your text_encoders folder, converts its HuggingFace-style key names into the layout Wan's code expects, and hands you a WANTEXTENCODER for XB_WanTextEncode to use. Display name "📝 Wan T5 加载器(FP8)". Without it, the text-encode node upstream has nothing to work with.

    How it works

    The interesting bit is the key remapping. A stock umt5-xxl safetensors stores weights under HF names like encoder.block.0.layer.1.DenseReluDense.wi_0.weight; the Wan codebase wants blocks.0.ffn.gate.0.weight and friends. This loader does that conversion in memory (_convert_t5_keys), then builds the encoder through the ComfyUI-WanVideoWrapper's wanvideo.modules.t5, loading the tokenizer from the wrapper's own configs/T5_tokenizer folder. It also sniffs the state dict: if the file you pointed it at is already fp8, it flips quantization on automatically.

    The inputs that matter

    Only two required, and one of them is a dropdown of files:

    • model_name - your umt5-xxl-encoder safetensors (or an fp8 variant). Goes in ComfyUI/models/text_encoders.
    • precision - bf16 default; fp16 saves a bit, fp32 is wasteful here.
    • load_device (optional) - defaults to offload_device, meaning the encoder sits in system RAM and only loads to the GPU when encoding. Good default.
    • quantization (optional) - disabled or fp8_e4m3fn. If your card is tight, fp8 roughly halves the ~9GB this thing costs.

    Output: a single t5_model socket (WANTEXTENCODER) that plugs straight into XB_WanTextEncode.

    Install

    The pack installs like the rest of XB_BOX - ComfyUI Manager search XB_ToolBox, or git clone https://github.com/WJLUOXIAO/XB_ToolBox into custom_nodes - then restart. Two prerequisites on top: the ComfyUI-WanVideoWrapper custom node (this loader constructs the encoder through it and needs its tokenizer files), and the actual umt5-xxl weights in text_encoders. Don't try to use this with the standard "Load CLIP" node - wrong type, wrong architecture.

    Common issues

    The loader will throw Invalid T5 model, expected 'umt5-xxl' format if you point it at a non-T5 file - that's your cue you grabbed the wrong download. If the node list is empty in model_name, you have nothing in text_encoders. And if ComfyUI dies with a wrapper-not-found error, that's the missing ComfyUI-WanVideoWrapper, not a bug in this node.

    CategoryXB_ToolBox/Wan

    Inputs (4)

    NameTypeDefaultDescription
    model_nameCOMBO0 options:
    precisionCOMBObf163 options: bf16, fp16, fp32
    load_deviceoptCOMBOoffload_device2 options: main_device, offload_device
    quantizationoptCOMBOdisabled2 options: disabled, fp8_e4m3fn

    Outputs (1)

    NameTypeDescription
    t5_modelWANTEXTENCODER