Load Depth Model (TensorRT)
Two seconds of deserializing, then 4× PyTorch
- trt_model
The point of building a TensorRT engine is that you only build it once. This node is how you cash that in: it deserializes a compiled engine from ComfyUI/models/depthanything/ and hands it over as a runnable handle. If your depth work is repetitive - a saved workflow, a batch, a video pass - you start here from now on and never touch the PyTorch loader again.
Why you'd reach for it
Because a .trt file is already compiled for your GPU, loading it costs a deserialize and nothing else. No checkpoint read, no graph parse, no kernel autotuning. You get the fastest backend in the pack: on the reference numbers at 784×1176 FP16, Large is 47.3 ms here versus 93.5 ms on fused ONNX and 127.3 ms on PyTorch. Small is 7.5 ms, which is the number that makes video-frame depth feel viable rather than theoretical.
Inputs and output
One input. model is a dropdown over .trt, .engine, and .plan files in ComfyUI/models/depthanything/ - three suffixes because TensorRT tooling from different eras uses different conventions, and this pack just accepts all of them. There is no device widget: engines require a CUDA device, and the node hard-codes that rather than offering you a CPU option that can't work.
The output is trt_model, a DEPTHACCEL_TENSORRT_MODEL handle that goes to Estimate Depth (TensorRT) and nowhere else. Handles don't survive a ComfyUI restart, so the loader re-runs on every queue - which is fine, it's the cheap part.
Under the hood, loading does a few sanity checks rather than trusting the file: it deserializes, then verifies the engine exposes exactly two tensors (one input, one output), reads the input dtype to decide whether it's holding an FP16 or FP32 engine, and pulls the profile's min/opt/max shapes so the estimator can bound your input against them. If the deserialized engine comes back empty, the error says so plainly instead of the process vanishing.
The version check is the good part
Serialized TensorRT engines are tied to the exact TensorRT version that built them, and to the GPU too. This is the single most common way people lose an afternoon to TensorRT - you upgrade a package, or copy an engine to a second machine, and get an opaque deserialize failure with no hint of the cause.
The pack heads that off. When the engine builder writes a .trt, it also writes a .version sidecar recording the TensorRT version. This loader reads that sidecar and compares it to the installed runtime, and if they differ you get a RuntimeError naming both versions and telling you to rebuild - via the node or via tools/export_tensorrt.py. Engines built elsewhere have no sidecar and skip the check, which cuts both ways: no false positives, and no help when a foreign engine won't load either.
The GPU half is unavoidable. Same machine, different card, or a driver/TRT upgrade, and you rebuild. Budget it: the first build is minutes, subsequent runs are seconds.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/PineCookie/ComfyUI-DepthAnythingAccel
cd ComfyUI-DepthAnythingAccel
python -m pip install safetensors huggingface-hub onnxruntime-gpu
python -m pip install tensorrt # optional, needed for engines
tensorrt is commented out in requirements.txt on purpose - ComfyUI Manager installs the loose core set (safetensors, huggingface-hub, onnxruntime-gpu) and leaves the heavy optional ones to you. If you skip it, load_tensorrt_model raises a one-line "TensorRT is not installed" error, which is about as friendly as a missing-compiler failure gets.
Troubleshooting
"Failed to deserialize TensorRT engine" with a matching version sidecar usually means the file is truncated (an interrupted build) or was built on a different GPU. Rebuild.
Nodes refuse the wire - the TensorRT handle only connects to the TensorRT estimator. If you're dragging it toward the ONNX node, you've built the wrong mental model: three backends, three handle types, three loader/estimator pairs.
The engine loads but the estimate errors on shape - that's the profile, not the load. The engine will only accept inputs between its min and max, and the error names the input shape and the profile it violates. Raise Max H/Max W on the builder and rebuild.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | TensorRT engine in ComfyUI/models/depthanything. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| trt_model | DEPTHACCEL_TENSORRT_MODEL | — |