Nodes/DGX Nodes/UNET Loader (Unified Memory)
ComfyUI Node

UNET Loader (Unified Memory)

Where the DGX pack's speed actually shows up

By broken-gage·Created 5 months ago·Updated 3 months ago· 1
UNET Loader (Unified Memory)
    • model
    • dgx_mode
    unet_name
    weight_dtype
    dgx_modetrue
    devicecuda:0
    load_threads1
    storage_backendauto

    The diffusion model - the thing people loosely call "the UNET," whether it's actually a UNet or a DiT transformer - is the biggest file in your workflow, and on a DGX Spark or GB10 it's where the stock loader wastes the most time. That's because ComfyUI's load path stages big weights through CPU when it can't tell your GPU memory is bigger than your system memory, and on a unified-memory machine those are the same pool. UNET Loader (Unified Memory) loads standalone diffusion models from diffusion_models/ directly into CUDA, which is the one node in this pack where the savings are genuinely dramatic.

    What it does

    It's the DGX Nodes replacement for the stock UNETLoader (and DiffusionModelLoader). You pick a file from diffusion_models/, optionally set an inference dtype, and get a model output to wire into your sampler. This is the loader for Flux-class DiT files, SDXL diffusers-style UNets, and the standalone checkpoints that modern workflows prefer over monolithic .ckpt files. It also auto-detects and converts diffusers-format models, just like the stock loader.

    The inputs that matter

    This node has the most knobs in the pack:

    • unet_name - the file from diffusion_models/.
    • weight_dtype - an optional inference dtype override: default, fp8_e4m3fn, fp8_e4m3fn_fast, or fp8_e5m2. This is where you force FP8 inference on a model that shipped in bf16, or pick the "fast" quantized path. If you're on a GB10, FP8 is where it's at - the hardware is built around it.
    • dgx_mode - ON (default) for the direct-to-CUDA path, OFF for stock loading.
    • device - cuda:0.
    • load_threads - an INT from 1 to 4. The tooltip is refreshingly honest: it's "reserved for compatibility with previous workflows." Leave it at 1.
    • storage_backend - auto, instanttensor, or fastsafetensors.

    The output nobody expects

    Besides model, this node returns a second output: dgx_mode, a BOOLEAN that reports which path actually ran. That's unique in the pack and genuinely handy - you can wire it into a conditional switch so downstream nodes behave differently depending on whether the DGX path engaged. If it fell back to stock on a non-DGX machine, the boolean tells your graph so, instead of guessing.

    The performance story

    This is the node the pack's benchmarks center on, and they're the reason to care: a Flux.2 Dev FP8 first run dropped from ~400 s on the native path to ~73 s with instanttensor, and ~90 s with fastsafetensors - roughly a 4–5× cut in load time, with inference speed unchanged. The instanttensor backend loads at ~1× memory (its load_now=False mode reads tensors one at a time), while fastsafetensors uses host-mmap plus CUDA DMA and can peak at ~2× physical memory. auto tries the former first, and that's the right order.

    Installing it

    One pack, seven loaders. ComfyUI Manager: search DGX Nodes. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/broken-gage/ComfyUI-DGX-Nodes
    pip install -r requirements.txt
    pip install instanttensor fastsafetensors
    

    Restart, look under DGX Nodes. Requires ComfyUI 0.24.0+.

    Gotchas

    • Safetensors only on the direct path - other formats fall back to stock loading, no error, just no speedup.
    • --disable-mmap is a DGX-only flag in the README's view. The fastsafetensors host-mmap path and unified memory can double-map if you're not careful; don't cargo-cult that startup flag onto a normal desktop.
    • ComfyUI's dynamic VRAM can make these backends peak ~30% higher transient RAM than native loaders. On a 128 GB Spark that's usually fine; on a squeezed system, mind it.
    • Weights bigger than available memory in dgx_mode can mean OOMs or instability. And yes - same pack caveats: experimental, GPLv3, vibe-coded, no guaranteed support. The upside here is big enough that it's the one node of the seven I'd install the pack for.
    CategoryDGX Nodes

    Inputs (6)

    NameTypeDefaultDescription
    unet_nameCOMBODiffusion model / UNET file from ComfyUI's diffusion_models directory.
    weight_dtypeCOMBOOptional inference dtype override for the loaded diffusion model.
    dgx_modeBOOLEANtrueON: use the DGX unified-memory direct-to-CUDA loading path. OFF: fall back to the stock ComfyUI loading pipeline.
    deviceCOMBOcuda:0CUDA device used for the DGX direct-load path when DGX mode is enabled.
    load_threadsINT11–4Parallel loader threads reserved for compatibility with previous workflows.
    storage_backendCOMBOautoauto: try instanttensor first (1x memory), then fastsafetensors. instanttensor: experimental CUDA safetensors path; load_now=False for minimal peak memory on unified memory. fastsafetensors: host-mmap + CUDA DMA path; 2x peak physical memory on unified memory systems.

    Outputs (2)

    NameTypeDescription
    modelMODEL
    dgx_modeBOOLEAN