Nodes/TensorRT Node for ComfyUI/STATIC_TRT_MODEL_CONVERSION
ComfyUI Node

STATIC_TRT_MODEL_CONVERSION

One Resolution, One Batch, All the Speed

By comfyanonymous·Created 2 years ago·Updated 2 years ago· 705
STATIC_TRT_MODEL_CONVERSION
  • model
    filename_prefixtensorrt/ComfyUI_STAT
    batch_size_opt1
    height_opt512
    width_opt512
    context_opt1
    num_video_frames14

    If you always generate at the same resolution - say 1024×1024 SDXL at batch 1, every time - you don't need a TensorRT engine that flexes across every shape under the sun. You need this node. STATIC_TRT_MODEL_CONVERSION builds an engine that's exactly as fast as the "ideal" settings of a dynamic engine, but for a single resolution and batch size. Same speed, less VRAM, smaller engine file, faster build. That's the whole pitch, and it's a good one.

    The catch is implied in the name: static. The engine serves precisely one shape, and it refuses to run anything else. If you're the sort of person who tweaks resolution per image, you want the dynamic node instead.

    How it works

    The node exports your UNet to an ONNX file, then hands it to the TensorRT builder, which compiles it into GPU-specific machine code and serializes it to a .engine file. It sets the FP16 flag (BF16 for Flux), and because everything is static, the builder's min/opt/max optimization profile collapses to your single value - that's where the VRAM savings come from. A timing cache (timing_cache.trt in the pack's folder) gets reused on later builds, so the second and third engines are much faster than the first.

    The output filename encodes exactly what the engine supports: stat-b-1-h-512-w-512 means batch 1, height 512, width 512. Read it before you complain that nothing loads.

    The inputs

    • model - the MODEL output of a Load Checkpoint node. Wire the checkpoint in, queue the prompt, and the build runs to completion in the console.
    • filename_prefix - defaults to tensorrt/ComfyUI_STAT. Keep the tensorrt/ prefix (that's where the loader looks) and rename the tail to something meaningful like tensorrt/sdxl_base_1024.
    • batch_size_opt, height_opt, width_opt - the one and only shape. Dimensions step by 64, from 256 to 4096. Pick values that match how you actually generate; 512 is the default and it's a trap if you're on SDXL.
    • context_opt - leave at 1 unless you know you need more text-embedding chunks.
    • num_video_frames - for SVD/SVD-XT, where it multiplies the batch dimension. Ignore it for image models.

    The node has no outputs. It's an output node - the engine file on disk is the product. You'll see the node stay highlighted while it works and a progress bar in the console. Image models take roughly 3–10 minutes to build; SVD can push 10–25; SVD-XT has been known to take the better part of an hour. That's normal. Go make coffee.

    Install and gotchas

    Same pack, same story as the TensorRT Loader: ComfyUI Manager (search "TensorRT Node for ComfyUI"), or git clone https://github.com/comfyanonymous/ComfyUI_TensorRT into custom_nodes and pip install -r requirements.txt. The dependency that actually matters is tensorrt>=10.0.1, and it needs an RTX card - non-negotiable. Note the requirements also pin onnx!=1.16.2, a known-bad release; if your build dies with ONNX errors, check your version.

    After the build finishes, refresh ComfyUI (F5) before the TensorRTLoader will see the new engine. And remember: no LoRAs or ControlNets on engines yet - that's a pack-wide limitation, not a bug in your setup. Change your mind about the resolution later? Rebuild with new values. It's a one-time cost you pay once per shape you care about.

    CategoryTensorRT

    Inputs (7)

    NameTypeDefaultDescription
    modelMODEL
    filename_prefixSTRINGtensorrt/ComfyUI_STAT
    batch_size_optINT11–100
    height_optINT512256–4096
    width_optINT512256–4096
    context_optINT11–128
    num_video_framesINT140–1000

    Outputs (0)

    No outputs