This project provides a Tensorrt implementation for fast image upscaling inside ComfyUI (3-4x faster)
Note: The following results were benchmarked on FP16 engines inside ComfyUI, using 100 frames
Device | Model | Input Resolution (WxH) | Output Resolution (WxH) | FPS |
---|---|---|---|---|
L40s | RealESRGAN_x4 | 512 x 512 | 2048 x 2048 | 5 |
L40s | RealESRGAN_x4 | 960 x 540 | 3840 x 2160 | 2 |
L40s | RealESRGAN_x4 | 1280 x 1280 | 5120 x 5120 | 0.7 |
Navigate to the ComfyUI /custom_nodes
directory
git clone https://github.com/yuvraj108c/ComfyUI-Upscaler-Tensorrt.git
cd ./ComfyUI-Upscaler-Tensorrt
pip install -r requirements.txt
-
Download one of the available onnx models. These models support dynamic image resolutions from 256x256 to 1280x1280 px (e.g 960x540, 360x640, 1280x720 etc). You can also convert other upscaler models supported by ComfyUI to onnx using export_onnx.py.
You can find addition models here : 4x-WTP-UDS-Esrgan for anime. (source) and 4x_RealisticRescaler_100000_G for realism. (source)
-
Edit model paths inside export_trt.py accordingly and run
python export_trt.py
-
Place the exported engine inside ComfyUI
/models/tensorrt/upscaler
directory
- Insert node by
Right Click -> tensorrt -> Upscaler Tensorrt
- Choose the appropriate engine from the dropdown
- Ubuntu 22.04 LTS, Cuda 12.3, Tensorrt 10.0.1, Python 3.10, L40s GPU
- Windows (Not tested)