Nodes/ComfyUI-DepthAnythingAccel/Load Depth Model (PyTorch)
ComfyUI Node

Load Depth Model (PyTorch)

Load Depth Model (PyTorch) is the front door — and it downloads your weights for you

By PineCookie·Created a day ago·Updated a day ago· 0
Load Depth Model (PyTorch)
    • model
    modeldepth_anything_v2_vitl_fp32.safetensors
    precisionauto

    Every DepthAnythingAccel graph starts here. One dropdown, one precision setting, one output - and if the checkpoint you picked isn't on disk yet, the node goes and fetches it while you watch the console. That last part is the reason most people meet this node before they've read a single line of the README.

    Why you'd reach for it

    Depth Anything V2 Large has been the default depth preprocessor in this ecosystem since mid-2024, and it still was through 2026 even after Depth Anything 3 shipped. It's the thing you feed a photo into when you want a depth map for a ControlNet, a parallax animation, a stereo pair, or a height field. If you've ever used a Kijai or comfyui_controlnet_aux preprocessor, this is the same model with a different wrapper around it - one that treats speed as the problem worth solving.

    That's the pitch of this pack: the same checkpoint on PyTorch, ONNX Runtime, or TensorRT, chained node-to-node in the graph instead of via command line. This node is the PyTorch end of that chain, and it's also where the other two backends get their weights from - Export to ONNX takes this node's output, and everything accelerated descends from it.

    How it works

    It loads the state dict (.safetensors or .pth) into the pack's own vendored copy of the Depth Anything V2 architecture - the DINOv2/DPT code is lifted from the official repo and stripped of its OpenCV image path, so nothing here depends on the original project being installed. Then it figures out what it's looking at: the encoder is read off the patch-embedding weight shape (384 channels = vits, 768 = vitb, 1024 = vitl, 1536 = vitg), and the DA2-versus-DAD family is inferred from the filename. Distill-Any-Depth is state-dict compatible with DA2, which is why one node set covers both.

    Precision is the only real decision. auto means FP16 autocast when CUDA is available and FP32 otherwise, and the tooltip is worth reading twice: the checkpoint itself is always kept in its native dtype. What you're choosing is the compute dtype for inference, not a re-quantization of the file.

    Inputs, outputs, wiring

    Two inputs. model is the checkpoint dropdown, populated from ComfyUI/models/depthanything plus every known model that could be downloaded there - defaults to depth_anything_v2_vitl_fp32.safetensors, with known files sorted by family then size so DA2 Large and DAD Large sit next to each other instead of wherever the alphabet put them. precision is auto / fp32 / fp16 / bf16.

    The single output is model, a DEPTHACCEL_MODEL handle. It goes into Estimate Depth (PyTorch) for a straight depth map, or into Export to ONNX if you're heading for the fast lane. Handles don't survive a restart, so re-run the load after you reload ComfyUI.

    Install

    ComfyUI Manager, search DepthAnythingAccel, install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/PineCookie/ComfyUI-DepthAnythingAccel
    cd ComfyUI-DepthAnythingAccel
    python -m pip install safetensors huggingface-hub onnxruntime-gpu
    

    The README's manual command lists safetensors onnxruntime-gpu, but requirements.txt also carries huggingface-hub, and you want it - the auto-download calls into it and fails with a clear message when it's missing. onnx, onnxslim, and tensorrt are commented out in requirements.txt because they're only needed for conversion or engine building; uncomment them (or pip them) when you get there. Deliberately loose versions, by the way: this pack is trying not to break your other nodes.

    The pack registers ComfyUI/models/depthanything/ itself, so nothing to configure. Downloads come from Kijai's safetensors repo, the official depth-anything repos, or xingyang1/Distill-Any-Depth, and the cached file is copied into the model folder under its canonical dropdown name.

    Watch out for

    Licensing. DA2 Small is Apache-2.0; Base, Large, and Giant are CC-BY-NC-4.0. If this is for paid work, you're on Small, or on a Distill-Any-Depth checkpoint - and read THIRD_PARTY.md rather than trusting a filename.

    Mismatch errors. If a checkpoint's embedding dimension doesn't match what the loader expected, the error says so directly and tells you which encoder to select. That's a helpful failure, not a crash.

    Old ComfyUI. This pack is written against the newer backend authoring API (from comfy_api.latest import io), so it has no NODE_CLASS_MAPPINGS dictionary. That's a "your ComfyUI is too old to see it" situation, not a broken install - and if you grep the source looking for the classic mapping, you'll find nothing and conclude the same wrong thing.

    CategoryDepthAnythingAccel/Reference

    Inputs (2)

    NameTypeDefaultDescription
    modelCOMBOdepth_anything_v2_vitl_fp32.safetensorsCheckpoint in ComfyUI/models/depthanything. A known model that is not present is downloaded automatically.
    precisionCOMBOautoauto uses FP16 autocast on CUDA and FP32 elsewhere; the loaded checkpoint is always kept in its native dtype.

    Outputs (1)

    NameTypeDescription
    modelDEPTHACCEL_MODEL