Upscale (TensorRT)
TensorRT Upscaling That Backs Off When It Runs Out of VRAM
- images
- upscaler_trt_model
- IMAGE
Upscaling means three different jobs that share a word: more pixels, more detail, or more pixels over time. This node does the first one - take an image that's already good and make it bigger, fast, without a diffusion model inventing eyeballs. It's an ESRGAN-class upscaler running through a TensorRT engine, tiled so big frames don't detonate your VRAM, with an automatic retry when they do anyway.
The name is the tell: Upscale (TensorRT). Not Upscale (SeedVR2), not Upscale (Supir). If your source is soft or damaged and you want the model to add detail, you're in the wrong tool and you'll be disappointed by how clean and boring the result is. If you want 4x the pixels in seconds, this is aimed at you.
The dependency nobody expects
It doesn't ship an upscaler and it doesn't build an engine. The upscaler_trt_model input is of type UPSCALER_TRT_MODEL, and nothing in this pack produces that type - you get it from the separate ComfyUI-Upscaler-Tensorrt package, where you export a .trt engine from an ONNX upscaler. This node literally reads that pack's load_upscaler_config.json to learn your engine's scale factor, falling back to parsing a leading 4x from the model name, and finally to assuming 4.
Also: the pack's requirements.txt contains no tensorrt at all. The TensorRT Python bindings and the engine have to come from that other install. Wire this node up before you've built an engine and you'll be hunting a phantom import error.
How the tiling works
It walks the image in square tiles one at a time, so only one tile's worth of activations is ever on the GPU. Each result is copied to a CPU-side float32 accumulator as it comes back. Tiles at the right and bottom edges get replicate-padded to the full tile size, inferred, then cropped back - which is why the tile size is a fixed choice rather than "whatever fits".
Overlap isn't stitched, it's feathered. Each tile contributes through a window whose edges ramp linearly from 0 to 1, so overlapping regions cross-fade instead of showing a hard line. Overlap is clamped to tile_size // 2 - 1, so cranking tile_overlap past that does nothing.
auto picks the starting tile from free VRAM at that moment: under 10 GiB gets 256, under 18 gets 384, under 28 gets 512, otherwise 640. On a CUDA or TensorRT out-of-memory it releases VRAM, steps down through smaller candidates (1024, 768, 640, 512, 384, 256), and retries - which is the "VRAM safe" part of the node's class name.
Inputs worth setting
images,upscaler_trt_model- the batch and the engine.resize_to-nonegives you the engine's native factor (a 4x engine gives 4x).customusesresize_width/resize_height.HD/FHD/2k/4kare 1280x720, 1920x1080, 2560x1440, 3840x2160 and swap orientation for portrait inputs.1x…10xare multipliers of the input dimensions.tile_size- leave it onautounless you're chasing a specific VRAM ceiling.tile_overlap- default 32. Raise it if you see faint grid lines in flat areas like skies.unload_models_on_oom-on_failure(default) unloads other models only when it actually OOMs,before_runclears the decks up front at the cost of a reload afterwards,neverkeeps everything resident and just retries.
Output is a single IMAGE batch, one per input frame, looped so a video sequence upscales frame by frame.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Mister-Link/link-comfy-nodes
cd link-comfy-nodes
pip install -r requirements.txt
Manager users: search Link Comfy Nodes. It's a personal pack with a one-line README and no community footprint - the author's own words are "use at your own risk, I change how nodes behave without warning".
Where people get burned
"requires CUDA." There's no CPU fallback and no ROCm path. The node checks and refuses outright.
Alpha dies. It raises TensorRT upscaling expects RGB images with 3 channels. Strip alpha first - the same pack has ReplaceAlpha for exactly this.
Watch 1x. A 4x engine asked for 1x upscales to 4x and then resamples back down, which costs the full upscale and loses the detail you just paid for. Use none unless you specifically need a target size.
Engines are machine-specific. A .trt file is compiled for a GPU architecture, driver and TensorRT version. Copy one from another machine, or update your driver, and it can fail to deserialize. Rebuild it rather than debugging it.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| upscaler_trt_model | UPSCALER_TRT_MODEL | — | |
| resize_to | COMBO | none | 19 options: none, custom, HD, FHD, 2k, 4k, +13 |
| resize_width | INT | 10241–8192 | — |
| resize_height | INT | 10241–8192 | — |
| tile_size | COMBO | auto | 7 options: auto, 256, 384, 512, 640, 768, +1 |
| tile_overlap | INT | 320–256 | — |
| unload_models_on_oom | COMBO | on_failure | 3 options: on_failure, before_run, never |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |