Nodes/XB_ToolBox/XB-BOX - 🧊 INT8 CLIP 加载器 (ROCm)
ComfyUI Node

XB-BOX - 🧊 INT8 CLIP 加载器 (ROCm)

INT8 text encoders for AMD cards that were dying on VRAM

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB-BOX - 🧊 INT8 CLIP 加载器 (ROCm)
    • CLIP
    clip_name
    type
    weight_dtype
    on_the_fly_quantizationfalse
    enable_convrottrue

    Text encoders are the forgotten VRAM hog: your T5 or similar CLIP model can eat several GB before a single pixel is generated, and on AMD cards - where the quantization ecosystem has always lagged NVIDIA's - that's often the thing that tips a workflow over the edge. XB_CLIPLoaderINT8ROCm loads a text encoder quantized to INT8, adapted from the ComfyUI-INT8-Fast-ROCM project, so the encoder's weights take a fraction of the space. If you're on ROCm and your VRAM budget is tight, this is the loader that buys you headroom.

    It's the single-encoder variant of a small ROCm quantization family in XB_ToolBox (there's a DualCLIPLoaderINT8ROCm for dual-encoder setups, plus INT8 save and LoRA nodes). The "ROCm" in the name is the tell: it's built with AMD's stack in mind, though the INT8 ops themselves aren't NVIDIA-hostile.

    How it works

    Mechanically it's a custom-ops CLIP loader. It reads the text encoder state dict, replaces the standard linear operations with Int8TensorwiseOps (INT8 quantized ops, optionally Triton-accelerated), and hands the result to ComfyUI's model patcher through a custom INT8ModelPatcher. The knobs:

    • weight_dtype - the compute dtype for the encoder (default/fp16/bf16/fp32). fp16 is the common choice; this is the compute precision the quantized weights run in, not the storage precision.
    • on_the_fly_quantization - if false, it expects pre-quantized weights; if true, it quantizes at load time. Turn it on for models that haven't been pre-quantized.
    • enable_convrot - enables the CONVROT grouped optimization (a rotation-based scheme to make INT8 conv/matmul faster on ROCm). Default on; toggle off if you hit a correctness/driver issue.

    There are two hard guardrails in the code worth knowing: it refuses to load scaled-FP8 encoder files (its INT8 ops can't mix with scaled-FP8 in the same encoder - the error tells you to use the stock loader for that file), and it excludes embedding/token_embedding/norm layers from quantization because those don't tolerate it.

    The inputs that matter

    • clip_name - your text-encoder file (dropdown of clip/text_encoders).
    • type - the architecture selector (stable_diffusion, sd3, ltxv, wan, cosmos, … - the full ComfyUI CLIPType list).
    • weight_dtype - compute precision, fp16/bf16 typical.
    • on_the_fly_quantization - quantize at load (true) vs. use pre-quantized weights (false).
    • enable_convrot - CONVROT optimization on/off.

    Output: CLIP - the quantized text encoder, ready for your text-encode node.

    Installing

    Ships in XB_ToolBox - ComfyUI Manager → XB_ToolBox, or

    cd ComfyUI/custom_nodes
    git clone https://github.com/WJLUOXIAO/XB_ToolBox.git
    

    restart. It imports the INT8 machinery from the pack's nodes_int8_rocm module, which needs a ROCm-enabled PyTorch build; no separate pip install is required beyond what the pack lists.

    Common issues

    • "This text encoder is scaled-FP8" error - by design. Use ComfyUI's stock CLIP loader for FP8 files; this node is for INT8.
    • Wrong output / NaN - usually enable_convrot on a driver combo it doesn't like. Flip it off and retest.
    • No speed gain on NVIDIA - this is a ROCm-oriented pack; on CUDA you're better served by the mainstream quantization loaders. Its value is on AMD.
    • Empty clip dropdown - no encoder files found in your clip folders; make sure your text-encoder files live where ComfyUI expects them.

    Honest framing: this node only matters if you're on AMD and squeezing VRAM. If that's you, an INT8 encoder instead of fp16 can free a gig or two - the exact difference between "workflow fits" and "workflow OOMs."

    Categoryloaders

    Inputs (5)

    NameTypeDefaultDescription
    clip_nameCOMBO0 options:
    typeCOMBO28 options: stable_diffusion, stable_cascade, sd3, stable_audio, mochi, ltxv, +22
    weight_dtypeCOMBO4 options: default, fp16, bf16, fp32
    on_the_fly_quantizationBOOLEANfalse
    enable_convrotBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    CLIPCLIP