XB-BOX - 🧊 INT8 CLIP 保存 (ROCm)
Save your INT8 text encoder once, reuse it forever
- clip
INT8 quantization has two modes: quantize every load (slow, but zero prep) or quantize once and save, then load the saved result directly (fast, but you have to set it up). XB_INT8CLIPSaveROCm is the "quantize once" side of that trade for the XB_ToolBox INT8 family. You load a text encoder in full precision, run it through this save node, and it writes a pre-quantized INT8 CLIP to disk - which the XB_DualCLIPLoaderINT8ROCm then loads with on_the_fly_quantization off, skipping the quantization cost on every future run.
This is a build-once node, not a workflow node. You run it when you're setting up your INT8 model collection, not in every generation. For anyone running Flux/SD3-class workflows on a limited AMD card, the payoff is real: the saved encoder loads faster and the quantization step disappears from each session's startup.
How it works
Feed it a clip (any CLIP you've loaded - stock loader or the pack's INT8 loader) and a filename_prefix. It walks the patched model, materializes any LoRA patches onto the weights so they're baked in, marks the modules with comfy_patched_weights so the save captures the actual quantized tensors (the int8 params), and writes a .pt file to your ComfyUI output folder under output/<filename_prefix>.safetensors-style naming - the default prefix int8_clip/INT8_CLIP puts it in an int8_clip subfolder.
The save carries metadata: the prompt that generated it and any extra_pnginfo get embedded as model metadata (unless you've disabled metadata globally). That's genuinely useful later when you find an odd .pt in your output folder and want to know which workflow produced it.
The node is an output node (nothing to chain forward), so its work is done the moment it writes the file. There's no return value to wire.
The inputs
- clip - the CLIP to quantize and save. Load it with the stock loader if you want a clean INT8 from source; the node can also re-save an already-INT8 clip.
- filename_prefix - where it lands. Default
int8_clip/INT8_CLIP; change it to something descriptive likeint8_clip/flux_dual_clipand you'll know exactly what you're loading later.
Install and gotchas
Standard XB_ToolBox install (Manager → XB_ToolBox, or git clone + restart), on a ROCm PyTorch setup with Triton available - the save depends on the same Int8TensorwiseOps machinery as the loaders. Then the real workflow:
- Run the save once with the encoders you want pre-quantized.
- Load them later with
XB_DualCLIPLoaderINT8ROCmandon_the_fly_quantizationoff.
The two traps: saving with the same prefix overwrites without warning - version your prefixes if you're experimenting; and a saved INT8 clip is only meaningful to this pack's loaders (and other INT8-Fast-ROCM-family nodes). It won't load in stock ComfyUI, and stock ComfyUI will not thank you for trying.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| filename_prefix | STRING | int8_clip/INT8_CLIP | — |
Outputs (0)
No outputs