Nodes/comfyui-sdnq-splited/SDNQ Model Loader
ComfyUI Node

SDNQ Model Loader

The node that squeezes FLUX.2 into a consumer GPU

By ussoewwin·Created 9 months ago·Updated 9 months ago· 3
SDNQ Model Loader
    • model
    • vae
    model_selectionFLUX.1-dev-qint8
    custom_model_path
    dtypebfloat16
    memory_modebalanced
    auto_downloadtrue
    matmul_precisionint8
    use_xformersfalse
    use_flash_attentionfalse
    use_sage_attentionfalse
    enable_vae_tilingfalse

    FLUX.2-dev is 32B of rectified-flow transformer plus a Mistral-class text encoder, and at fp8 that's roughly 35 GB before you even think about the encoder. On a 12–16 GB card, the whole model doesn't fit. SDNQ is the answer: Disty0's SD.Next Quantization engine quantizes diffusers pipelines down to uint4/int8, and this node is how you load those quantized models inside ComfyUI. It's the front door to the whole comfyui-sdnq-splited pack - everything else in it consumes whatever this node hands you.

    This pack is a fork of the original comfyui-sdnq by EnragedAntelope, and the fork's whole point is splitting one monolithic sampler into a standard ComfyUI shape: Model Load → LoRA → Sample. That means this loader behaves like the loaders you already know, except the thing it loads isn't a checkpoints file in your models folder - it's a diffusers pipeline reconstructed from a HuggingFace repo.

    What you actually set

    Only a few fields matter on a first run. model_selection is a dropdown of 20+ pre-configured SDNQ models that auto-download from HuggingFace on first use - FLUX.2-dev-SDNQ-uint4 is the one this pack was built and tested around, though the list also carries FLUX.1-dev, Qwen-Image and more (the README is honest that only FLUX.2 is actually supported/tested). Choose [Custom Path] and fill custom_model_path if you've already downloaded a model or want something not in the list.

    The two that shape everything else:

    • memory_mode - gpu keeps everything on the card (needs 24 GB+), balanced offloads to CPU (12–16 GB), lowvram does sequential offloading (around 8 GB, slowest). Start at balanced if you're on a 12–16 GB card and step down only if you OOM.
    • dtype - bfloat16 is the recommendation for FLUX (best quality/speed on modern cards); float16 is for older GPUs without bf16; float32 for CPU-only masochists.

    Leave auto_download on unless you want strictly-local model use. The optional row is where the attention and VAE tweaks live: use_xformers, use_flash_attention, use_sage_attention, and enable_vae_tiling (flip that last one for anything over 1536px to avoid OOM). One honest caveat from the README: those attention optimizations do nothing for Flux2's architecture - that's what the pack's TorchCompile node is for. matmul_precision (int8/fp8/none) only matters if you're on Linux/WSL with Triton available.

    Outputs and where they go

    The node outputs two things: model (MODEL - wire it into SDNQ Sampler V2 or Flux2 SDNQ Sampler V2) and vae (VAE), which is the diffusers VAE wrapped so ComfyUI can talk to it. That second output matters for img2img: feed it into SDNQ VAE Encode.

    Install and gotchas

    cd ComfyUI/custom_nodes/
    git clone https://github.com/ussoewwin/comfyui-sdnq-splited.git
    cd comfyui-sdnq-splited
    pip install -r requirements.txt
    

    Then restart ComfyUI. ComfyUI Manager also finds it, but expect the security-level wall: "only custom nodes from the default channel can be installed" means you either lower ComfyUI's Security Level in Settings, or use Manager's "Install via Git URL" with the repo above. The dependencies are the heavy part - sdnq, diffusers>=0.36.0 (the requirements note it may need pip install git+https://github.com/huggingface/diffusers.git if not on PyPI yet), transformers, accelerate, torch>=2.0. Models cache in ComfyUI/models/diffusers/sdnq/, so the first run downloads several GB and every run after is free.

    Where people get burned: picking a big model with memory_mode set too high, expecting FLUX.1 models in the dropdown to be as battle-tested as FLUX.2 (they aren't), and wondering why a 4-bit model still takes minutes - quantization cuts VRAM, not necessarily wall-clock time on an offloading setup.

    Categoryloaders/SDNQ

    Inputs (10)

    NameTypeDefaultDescription
    model_selectionCOMBOFLUX.1-dev-qint8Select a pre-configured SDNQ model (auto-downloads from HuggingFace) or choose [Custom Path] to specify a local model directory
    custom_model_pathSTRINGLocal path to SDNQ model directory (only used when [Custom Path] is selected). Example: /path/to/model or C:\path\to\model
    dtypeCOMBObfloat16Model precision. bfloat16 recommended for FLUX (best quality/speed). float16 for older GPUs. float32 for CPU.
    memory_modeCOMBObalancedMemory management: 'gpu' = All on GPU (fastest, needs 24GB+ VRAM). 'balanced' = Model offloading (12-16GB VRAM). 'lowvram' = Sequential offloading (8GB VRAM, slowest).
    auto_downloadBOOLEANtrueAutomatically download model from HuggingFace if not found locally. Disable to only use local models.
    matmul_precisionoptCOMBOint8Precision for Triton quantized matmul. 'int8' is standard, 'fp8' for newer GPUs (Ada/Hopper), 'none' to disable optimization. Requires Linux/WSL.
    use_xformersoptBOOLEANfalseEnable xFormers memory-efficient attention for 10-45% speedup. Works with all memory modes (gpu/balanced/lowvram). Auto-fallback to SDPA if xformers not installed or incompatible. Requires: pip install xformers
    use_flash_attentionoptBOOLEANfalseEnable Flash Attention (FA) for faster inference and lower VRAM usage. Requires ComfyUI started with --use-flash-attention flag. Works with modern GPUs (Ampere+).
    use_sage_attentionoptBOOLEANfalseEnable Sage Attention (SA) for optimized attention computation. Requires ComfyUI started with --use-sage-attention flag. Provides better performance on supported GPUs.
    enable_vae_tilingoptBOOLEANfalseEnable VAE tiling for very large images (>1536px). Prevents out-of-memory errors on high resolutions. Minimal performance impact. Recommended for images >1536x1536.

    Outputs (2)

    NameTypeDescription
    modelMODEL
    vaeVAE