This node enables the best performance on NVIDIA RTX™ Graphics Cards (GPUs) for Stable Diffusion by leveraging NVIDIA TensorRT.
This node enables the best performance on NVIDIA RTX™ Graphics Cards (GPUs) for Stable Diffusion by leveraging NVIDIA TensorRT.
Supports:
Requirements:
The recommended way to install these nodes is to use the ComfyUI Manager to easily install them to your ComfyUI instance.
You can also manually install them by git cloning the repo to your ComfyUI/custom_nodes folder and installing the requirements like:
cd custom_nodes
git clone https://github.com/comfyanonymous/ComfyUI_TensorRT
cd ComfyUI_TensorRT
pip install -r requirements.txt
NVIDIA TensorRT allows you to optimize how you run an AI model for your specific NVIDIA RTX GPU, unlocking the highest performance. To do this, we need to generate a TensorRT engine specific to your GPU.
You have the option to build either dynamic or static TensorRT engines:
Note: Most users will prefer dynamic engines, but static engines can be useful if you use a specific resolution + batch size combination most of the time. Static engines also require less VRAM; the wider the dynamic range, the more VRAM will be consumed.
You can find different workflows in the workflows folder of this repo. These .json files can be loaded in ComfyUI.
Add a Load Checkpoint Node
Add either a Static Model TensorRT Conversion node or a Dynamic Model TensorRT Conversion node to ComfyUI
Connect the Load Checkpoint Model output to the TensorRT Conversion Node Model input.
To help identify the converted TensorRT model, provide a meaningful filename prefix, add this filename after “tensorrt/”
Click on Queue Prompt to start building the TensorRT Engines
The Model Conversion node will be highlighted while the TensorRT Engine is being built.
Additional information about the model conversion process can be seen in the console.
The first time generating an engine for a checkpoint will take awhile. Additional engines generated thereafter for the same checkpoint will be much faster. Generating engines can take anywhere from 3-10 minutes for the image generation models and 10-25 minutes for SVD. SVD-XT is an extremely extensive model - engine build times may take up to an hour.
TensorRT Engines are loaded using the TensorRT Loader node.
ComfyUI TensorRT engines are not yet compatible with ControlNets or LoRAs. Compatibility will be enabled in a future update.