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

Dual CLIP Loader (Unified Memory)

Two text encoders, one node, no CPU detour

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

    Some of the most popular model families don't have one text encoder - they have two. Flux pairs a large T5 with a CLIP-L, SDXL runs two CLIPs of different sizes, Hunyuan Video wants its own pair. Stock ComfyUI handles this with DualCLIPLoader, which takes two files and builds a single combined CLIP object. Dual CLIP Loader (Unified Memory) is the DGX Nodes pack's version of that node, and it's the one you want on a DGX Spark or GB10 where the stock loader wastes time staging text encoder weights through the shared CPU/GPU memory pool.

    What it does

    You pick clip_name1 and clip_name2 from text_encoders/, choose the family from the type dropdown, and get a single CLIP output that you wire into CLIPTextEncode exactly as you would a single encoder. The type list is the guide to what pairs go together: sdxl, sd3, flux, hunyuan_video, hunyuan_image, hunyuan_video_15, hidream, kandinsky5, kandinsky5_image, ltxv, newbie, and ace. Pick flux and load t5xxl_fp8_e4m3fn.safetensors as clip_name1 and clip_l.safetensors as clip_name2, for the canonical example.

    How it works

    Under the hood this node reuses the single CLIP loader's direct path, just with two files. Both encoders are read straight into CUDA, each is normalized (metadata tensors like tokenizer spiece models get parked on CPU, where ops expect them), and both are combined into one CLIP object whose skeleton is built on the right device. The pack's usual bookkeeping follows: ComfyUI's memory tracking is corrected so the combined encoder reads as already-loaded and doesn't get evicted by your sampler or trigger a cascade of reloads.

    The one thing to be careful about: clip order and type matter together. The first slot is conventionally the larger encoder for Flux-style pairs, and the type value must match the family of both files. Mix a flux type with an SDXL pair and you'll get a construction error or, worse, silently wrong conditioning.

    Inputs in practice

    • clip_name1 / clip_name2 - the two files from text_encoders/.
    • type - the dual-encoder family, the setting that must match both files.
    • dgx_mode - ON (default) for the DGX direct path, OFF for stock loading.
    • device - default, cuda:0, or cpu. As with the single CLIP loader, cpu requires dgx_mode OFF - turning DGX mode on with a CPU device raises an error.
    • storage_backend - auto first, then pick a specific backend if you're tuning.

    Installing it

    It ships in the DGX Nodes pack with six siblings, so one install covers all of them. Via ComfyUI Manager, search DGX Nodes; or manually:

    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 and look under the DGX Nodes category. Requires ComfyUI 0.24.0+.

    Gotchas

    • Backend gotcha applies here too: on Windows or any machine without the DGX backends, this node falls back to stock dual-CLIP loading silently. Safe to leave in a shared workflow; useless to claim credit on non-DGX rigs.
    • Both files must be safetensors for the direct path; unsupported formats trigger the stock fallback rather than an error.
    • Same pack-level caveats as its siblings: experimental, GPLv3, AI-assisted "vibe-code" per the README, no guaranteed support. The DGX path is opt-in via the toggle, which is the right risk posture.
    CategoryDGX Nodes

    Inputs (6)

    NameTypeDefaultDescription
    clip_name1COMBOFirst text encoder file from ComfyUI's text_encoders directory.
    clip_name2COMBOSecond text encoder file from ComfyUI's text_encoders directory.
    typeCOMBODual-encoder model family used to construct the combined CLIP object.
    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