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

CLIP Loader (Unified Memory)

Skip the text-encoder stall on your DGX

By broken-gage·Created 5 months ago·Updated 3 months ago· 1
CLIP Loader (Unified Memory)
    • CLIP
    clip_name
    type
    dgx_modetrue
    devicedefault
    storage_backendauto

    On a Flux or SD3 workflow, the text encoder is a quiet bottleneck. It's not the biggest file on disk, but on a DGX Spark or GB10 - where CPU and GPU share one unified 128 GB pool - the stock loader stages it through CPU anyway, and you feel it as an extra stall before the first image ever appears. CLIP Loader (Unified Memory) is the DGX Nodes pack's replacement for ComfyUI's stock CLIPLoader: same job, same output, but with a direct-to-CUDA path that keeps the encoder resident on the GPU.

    What it does

    It loads a single text encoder file from text_encoders/ and hands you a CLIP object, which you wire into CLIPTextEncode (or whatever encoder node your model family uses). The one non-obvious input is type - a dropdown of 23 model families that tells ComfyUI how to construct the encoder. The list runs from the classics (stable_diffusion, sd3, stable_cascade) through the current crop (flux2, wan, mochi, ltxv, cosmos, lumina2, hidream, chroma, qwen_image, hunyuan_image) and out to niche entries like pixeldit and ideogram4. Get this wrong and you'll get a construction error or, worse, gibberish conditioning that decodes fine and looks nothing like your prompt.

    How the DGX path works

    Same story as the pack's checkpoint loader: tensors are read straight into CUDA, the CLIP is built from already-resident weights with assign=True (no CPU staging copy), and ComfyUI's memory tracking is corrected afterward. One subtlety worth knowing: for regular CLIP weights it builds the skeleton on the meta device, but for quantized text encoders (the MixedPrecisionOps ones ending in .comfy_quant) it constructs on CUDA directly - meta-backed quantized tensors lose their data. The net effect is you don't need to patch ComfyUI core files, and the encoder doesn't get needlessly evicted when your sampler kicks in.

    Inputs you'll actually touch

    • clip_name - the file from text_encoders/.
    • type - the model family, as above. The one input beginners miss.
    • dgx_mode - ON (default) uses the DGX path; OFF is stock loading.
    • device - default, cuda:0, or cpu. Note the tooltip: cpu only works when dgx_mode is OFF. Turning dgx_mode on with device=cpu raises an error.
    • storage_backend - auto (try instanttensor at ~1× memory, then fastsafetensors at ~2×) or a specific backend.

    Installing it

    Install the whole pack once - all seven loaders ship together. Via ComfyUI Manager, search DGX Nodes; or:

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

    Restart ComfyUI; the nodes land under DGX Nodes. Needs ComfyUI 0.24.0+.

    Gotchas

    • CPU loading is a fallback-only path here. If you genuinely want the text encoder on CPU (some low-VRAM setups do), leave dgx_mode off.
    • Like every node in this pack, on Windows or non-DGX machines it silently falls back to stock ComfyUI loading, so it's safe to keep in shared workflows - it just won't accelerate anything there.
    • The pack's README is admirably candid: this is a vibe-coded, GPLv3, agentic-AI project with no guaranteed support. For a loader that wraps ComfyUI's own load_clip, the risk is low, but the DGX path is experimental - instanttensor especially, which is described as work-in-progress.
    CategoryDGX Nodes

    Inputs (5)

    NameTypeDefaultDescription
    clip_nameCOMBOText encoder file from ComfyUI's text_encoders directory.
    typeCOMBOTarget CLIP family / model type used to construct the text encoder.
    dgx_modeBOOLEANtrueON: use the DGX unified-memory direct-to-CUDA loading path. OFF: fall back to the stock ComfyUI loading pipeline.
    deviceCOMBOdefaultdefault/cuda devices use the DGX direct-load path when DGX mode is enabled. cpu is supported only when DGX mode is disabled.
    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 (1)

    NameTypeDescription
    CLIPCLIP