Nodes/XB_ToolBox/XB-BOX - 🧊 INT8 预加载 LoRA (ROCm)
ComfyUI Node

XB-BOX - 🧊 INT8 预加载 LoRA (ROCm)

Pre-load a LoRA so it gets baked into the INT8 weights

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB-BOX - 🧊 INT8 预加载 LoRA (ROCm)
    • PRE_LORA
    lora_name_1
    lora_strength_11.00

    Normally you apply a LoRA after the model loads, by patching weights on top of the base. On the INT8 ROCm path in XB_ToolBox that's the slow way: the model is quantized, and every LoRA you slap on afterwards forces a dequantize-patch-requantize cycle on the affected layers. XB_INT8PreLoraLoaderROCm takes the opposite approach - you pick your LoRA before the model is quantized, so it gets merged into the weights during quantization and becomes part of the baked artifact. The author's own framing: "预加载LoRA以在量化时烘焙" - pre-load the LoRA to bake it in at quantization time.

    The payoff is a model that's already got its LoRA fused in, which means no patching overhead at inference and a saved file (XB_INT8ModelSaveROCm materializes pre-loaded LoRAs before saving) you can load and go with. If you're building a repeatable workflow with one fixed style, this is the cleaner design.

    How it works

    This node doesn't touch a model at all. It just builds a small list - PRE_LORA - of the LoRA names and strengths you selected, and you wire that list into the pre_lora input of XB_UNetLoaderINTROCm. The loader takes that list, merges the LoRA into the fp16/whatever-precision weights first, and quantizes the result. The LoRA isn't patched on later; it's literally part of the tensors that get quantized.

    There's a hidden trick worth knowing: the schema only shows lora_name_1 and lora_strength_1, but the node scans your workflow's inputs and picks up every lora_name_N / lora_strength_N pair you add - so you can stack several LoRAs onto one pre-load node by adding inputs. Multi-LoRA stacks bake in together, in order.

    Inputs and output

    • lora_name_1 - dropdown of every LoRA in your models/loras folder, plus None. This is the only thing you really set.
    • lora_strength_1 - float, −10 to +10, default 1.0. Negative strengths work fine here (they're just merged before quantization). Zero skips the LoRA entirely.

    Output is a single PRE_LORA wire, which goes into the INT8 UNet loader's pre_lora socket. Nothing else consumes it.

    Installing and the catch

    Part of the XB_ToolBox suite - install via ComfyUI Manager (search XB_ToolBox) or:

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

    then restart ComfyUI. This node itself needs nothing extra; it's pure list-building.

    One honest caveat before you get excited: baking a LoRA into quantized weights is permanent. If you bake style A and then want style B, you re-quantize or load a second model - you can't just swap the LoRA anymore. And because quantization is lossy, the baked result isn't bit-identical to "quantize base, then patch LoRA"; the LoRA's influence goes through the quantization itself. In practice people report it holds up fine, but it's a trade you're making deliberately. If you need to swap LoRAs per generation, use the regular XB_INT8LoraROCm patch-on-load path instead and skip pre-loading. This node is for the "one fixed look, optimized forever" workflow, and it's very good at that.

    Categoryloaders

    Inputs (2)

    NameTypeDefaultDescription
    lora_name_1COMBO1 options: None
    lora_strength_1FLOAT1.00-10–10

    Outputs (1)

    NameTypeDescription
    PRE_LORAPRE_LORA