Nodes/ComfyUI-TensorRT-Reforge/TensorRT Loader Reforge
ComfyUI Node

TensorRT Loader Reforge

Loading Your TensorRT Engine Without Rebuilding It

By zaochuan5854·Created 5 months ago·Updated 2 months ago· 23
TensorRT Loader Reforge
    • MODEL
    model_path
    model_typesdxl_base

    TensorRT Loader Reforge is the node that makes all the export pain worth it. Everything before this - the ONNX export, the engine build, the minutes of your life the first compile ate - exists so this node can hand a pre-optimized engine to your KSampler and let you generate at a fraction of the usual cost. You reach for it when you've already got a .engine or .bundle file sitting in your models/tensorrt or output/tensorrt folder and you want the speed without thinking about any of it again.

    The "Reforge" is a fork, not a rebrand. This pack is a modernized rebuild of comfyanonymous's original ComfyUI_TensorRT, and the loader keeps the classic two-input setup that fork made famous. The name is doing honest work: TensorRT is notoriously static, and this loader's party trick is that it can also swap LoRA weights into a compiled engine without rebuilding it.

    How it works

    TensorRT turns your UNet or DiT into a hardened, hardware-tuned engine: kernel fusion, algorithm selection, the works. The loader does the boring-but-essential job of getting that engine back into a shape ComfyUI understands. Under the hood it deserializes the engine bytes and wraps them in a ComfyUI MODEL with the diffusion model replaced by a TensorRT runner - so downstream, the graph looks completely normal.

    The interesting case is the .bundle. When you export with LoRA support enabled (or export an Anima model), the exporter writes a single .bundle file containing the engine plus a weight map and, for Anima, an extra ONNX blob for its LLM adapter. At load time, the loader reads that map and builds a dummy state dict. ComfyUI's LoRA machinery then runs exactly as it always does - it computes weight deltas and applies them - but instead of touching real weights, those deltas trigger a Refit: NVIDIA's API for swapping weights into an already-compiled engine. The result is LoRA support at TensorRT speed, in seconds, where the old path meant a 3–10 minute engine rebuild every time you changed a LoRA.

    The two inputs, and the one output

    The whole node is two dropdowns. That's it.

    • model_path - a combo that lists everything in your models/tensorrt and output/tensorrt folders, both .engine and .bundle files. This is where the file must live; if it isn't there, the dropdown won't see it.
    • model_type - pick the architecture the engine was exported for: SD15, SDXL, Flux, SD3, AuraFlow, Anima, or SVD. A neat touch: the pack ships a little JS extension that reads the model type off the filename (the exporter bakes it in, e.g. ..._BS1_W1024_H1024_CM1.SDXL.engine) and auto-selects the dropdown for you. If it's wrong, the load will fail - so fix it by hand.

    It outputs a single MODEL, which wires straight into a KSampler. Load engine → condition → sample → decode. Your graph doesn't change at all.

    Installing it

    CUDA 12.x is a hard requirement - 12.8 is recommended, CUDA 11 is a no-go, and 13.x isn't supported yet. Then:

    cd ComfyUI/custom_nodes
    git clone https://github.com/zaochuan5854/ComfyUI-TensorRT-Reforge.git
    pip install -r requirements.txt
    

    Restart ComfyUI. ComfyUI Manager also finds it if you search "ComfyUI-TensorRT-Reforge". The requirements pull in NVIDIA's tensorrt-cu12 wheels (10.15.1+) plus onnx, onnxruntime-gpu and friends - that's the heavy part, and it's why the Python environment needs to be the one matching your CUDA toolkit.

    Where people get burned

    The single most common error is a shape mismatch. TensorRT is optimized for the exact shapes you exported - your input latent's width, height, and batch size must match the engine's optimization profile. Export for 1024×1024 and then feed the engine a 512×768 latent, and you get a runtime error, not a warning. If you need different sizes, you export a dynamic-shape engine (that's what the min/max inputs on the exporter are for) or you export again. Check your latent size and batch before you suspect the node itself.

    Also worth knowing: if you load an old .engine built without LoRA support, you get the static behavior you signed up for - no LoRA refit, because the engine wasn't built with the REFIT flag. That's the one case where "rebuild it" is the actual answer.

    CategoryTensorRT

    Inputs (2)

    NameTypeDefaultDescription
    model_pathCOMBO0 options:
    model_typeCOMBOsdxl_base7 options: SD15, SDXL, AuraFlow, Flux, SD3, Anima, +1

    Outputs (1)

    NameTypeDescription
    MODELMODEL