Nodes/XB_ToolBox/XB-BOX - 🧊 INT8 模型保存 (ROCm)
ComfyUI Node

XB-BOX - 🧊 INT8 模型保存 (ROCm)

Save the INT8 model so you never re-quantize it again

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB-BOX - 🧊 INT8 模型保存 (ROCm)
  • model
    filename_prefixint8_models/INT8_Model

    If you're on AMD hardware and you've been feeding a big Wan or LTX model through XB-BOX's INT8 path, you've probably noticed the annoying part: every time you load the model, it quantizes it on the fly again. That's CPU and VRAM churn you pay on every single load, and it's the exact problem this node exists to fix. XB_INT8ModelSaveROCm takes the quantized model you currently have in memory and writes it to disk as a .safetensors, so next time you can load the saved file directly and skip the whole re-quantization dance.

    It's an output node - you drop it at the end of a workflow (or in a one-shot "bake it" workflow), run once, and it writes the file. It belongs to the ROCm INT8 family in XB_ToolBox, alongside XB_UNetLoaderINTROCm and the INT8 LoRA nodes, and it's built around one specific workflow: quantize, optionally bake a LoRA in, save, then load the saved artifact on every real run.

    What it actually does

    When you load an INT8 model through the companion loader, ComfyUI ends up with a model whose weights are torch.int8 tensors plus a few bookkeeping extras - the comfy_quant metadata that records the quantization format (tensorwise, per-row, convrot groupsize), and the weight_scale tensors that let the loader restore the scale factors. This node walks the loaded model, collects all of that, and writes it out through ComfyUI's normal save path. The saved file carries the original safetensors metadata along with it, so a saved INT8 model still knows what it came from.

    It also does two things that matter in practice. First, it tries a full GPU load before saving, so everything gets materialized and written correctly rather than saved from a partially-offloaded state. Second, if you used XB_INT8PreLoraLoaderROCm to pre-load LoRAs, it materializes those LoRA patches into the weights before saving - which is the whole point of pre-loading. The LoRA becomes a permanent part of the saved quantized file, and you never have to apply it at load time again.

    The inputs

    Only two, and only one you'll touch:

    • model - a MODEL. Not just any model: it needs to be one loaded through the INT8 ROCm path (XB_UNetLoaderINTROCm), because that's where the comfy_quant metadata and int8 weights come from. Feed it a normal fp16 checkpoint and this node has nothing meaningful to save.
    • filename_prefix - defaults to int8_models/INT8_Model. Like every ComfyUI save node, the file lands in your output directory under that prefix, with an auto-incrementing counter: output/int8_models/INT8_Model_00001_.safetensors.

    That's it. No outputs - it's a sink node.

    Installing it

    This is part of the big XB_ToolBox suite, so installing the pack gets you this node:

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

    or search for XB_ToolBox in ComfyUI Manager and click install, then restart. No extra pip packages are needed for this specific node - the README's "no extra pip dependencies" claim holds for the core nodes; the heavy requirements.txt entries (llama-cpp-python, easyocr, CosyVoice3 deps) are for other corners of the suite.

    Where people get burned

    The most common mistake is feeding this node a model that never went through the INT8 loader, or that had its quantization stripped by a vanilla LoRA applied afterwards. You'll see a warning in the console - source safetensors metadata not found, save may be incomplete - which means the saved file probably won't reload as a proper INT8 model. Fix: route the model through XB_UNetLoaderINTROCm, apply LoRAs with the INT8 LoRA nodes (or pre-load them), and only then hit save.

    Also remember it saves to output, not models, so if you go hunting for your freshly-baked file, look in the output folder. And since quantization is a lossy operation, bake once and keep the original checkpoint around - if you later want a different quant format or no quantization at all, the source model is the only way back.

    Categoryloaders

    Inputs (2)

    NameTypeDefaultDescription
    modelMODEL
    filename_prefixSTRINGint8_models/INT8_Model

    Outputs (0)

    No outputs