Nodes/ComfyUI-Magic-Assistant/📦 SDNQ模型加载器 Magic SDNQ Model Loader
ComfyUI Node

📦 SDNQ模型加载器 Magic SDNQ Model Loader

The low-VRAM SDNQ model loader

By shigjfg·Created 8 months ago·Updated 11 days ago· 37
📦 SDNQ模型加载器 Magic SDNQ Model Loader
  • clip
  • vae
  • model
  • clip
  • vae
model_selectionFLUX.1-dev-SDNQ-uint4
custom_repo_or_path
dtypebfloat16
memory_modebalanced
auto_downloadtrue
enable_vae_tilingtrue
use_quantized_matmultrue
use_torch_compiletrue
use_xformerstrue

SDNQ is the quantization format of the moment for running big models on small cards - the community's shorthand is "like svdquant, but faster to quantize and gentler on lower-spec GPUs" - and it's one of the few quantization routes that genuinely targets the 8–16GB VRAM crowd. Magic SDNQ Loader is a standalone loader that wraps an SDNQ model into ComfyUI's familiar MODEL + CLIP + VAE triple, so you can use an SDNQ-quantized FLUX, FLUX.2, Qwen-Image, or Z-Image like any checkpoint. No single-big-monolithic-sampler setup required.

The pack's design decision is what makes it feel normal: instead of a combined loader-plus-sampler blob, it splits into this loader and a separate Magic SDNQ K Sampler, with loading and sampling logic that mirrors ComfyUI's official nodes. The README is explicit that this is built on the comfyui-sdnq main branch (by EnragedAntelope) and supports all adapted models, not a single architecture. The one boundary: image models only - no video, at least for now.

Inputs that matter

  • model_selection - a dropdown of known SDNQ repos (FLUX.1-dev, FLUX.1-schnell, FLUX.2-dev, FLUX.2-klein 4B/9B, Qwen-Image variants, Z-Image, and more), plus --Custom Model-- for anything else. custom_repo_or_path takes a HuggingFace repo ID or local path when you pick Custom.
  • dtype - bfloat16 / float16 / float32
  • memory_mode - the tooltips are the guide: gpu for 24GB+, balanced (CPU offload, 12–16GB), lowvram (sequential offload, ~8GB)
  • auto_download - on by default; if the model isn't cached it pulls from HuggingFace
  • enable_vae_tiling - VAE tiles big images to save VRAM
  • use_torch_compile - read this one: first compile takes 30–60 seconds, then 2–3x faster afterward; on 12GB the tooltip says turn it off to avoid OOM
  • use_xformers - faster attention (10–45%) with a graceful fallback to SDPA if xFormers isn't installed

Outputs are model, clip, vae - the standard triple, so your conditioning and VAE decode wiring doesn't change at all.

The body-only trick

The optional clip and vae inputs are where the VRAM win gets bigger. Connect both and, for FLUX-family models, the loader loads only the transformer body (~5GB) from the SDNQ folder and uses your external CLIP and VAE - less VRAM, and per the README, potentially better quality and speed. Connect only one and it errors deliberately; connect neither and it does a full-package load. That "both or neither" rule is the one thing people hit first, so remember it.

Installing - the part everyone skips

This is where the pack's README splits from the usual "clone and go":

cd ComfyUI/custom_nodes/
git clone https://github.com/shigjfg/ComfyUI-Magic-Assistant.git
cd ComfyUI-Magic-Assistant
pip install -r requirements.txt
pip install -r requirements-sdnq.txt   # adds sdnq + huggingface-hub

The requirements-sdnq.txt file installs sdnq and huggingface-hub, and the README also points you at the SDNQ technical source repo's tutorial for the diffusers/transformers environment. The good news: the pack lazy-loads SDNQ, so if you skip this step the rest of the pack still works - the SDNQ nodes just error when you try to use them. Models themselves come from the Disty0 SDNQ HuggingFace collection (auto-downloaded), and there's a local SDNQ models directory if you'd rather manage files yourself.

Troubleshooting

  • import sdnq fails → you didn't run requirements-sdnq.txt. That's the #1 error.
  • OOM during first compileuse_torch_compile off.
  • "Please connect both external CLIP and VAE" → yes, it's intentional. Both or nothing.
  • Slow first load → torch compile is compiling. Let it finish once.
Category✨ Magic Assistant

Inputs (11)

NameTypeDefaultDescription
model_selectionCOMBOFLUX.1-dev-SDNQ-uint416 options: --Custom Model--, FLUX.1-dev-SDNQ-uint4, FLUX.1-schnell-SDNQ-uint4, FLUX.1-Krea-dev-SDNQ-uint4, FLUX.1-Kontext-dev-SDNQ-uint4, FLUX.2-dev-SDNQ-uint4, +10
custom_repo_or_pathSTRING
dtypeCOMBObfloat163 options: bfloat16, float16, float32
memory_modeCOMBObalancedgpu=全显存(24GB+), balanced=CPU卸载(12-16GB), lowvram=顺序卸载(8GB)
auto_downloadBOOLEANtrue模型未缓存时自动从 HuggingFace 下载
enable_vae_tilingBOOLEANtrue大图时 VAE 分块处理省显存
use_quantized_matmulBOOLEANtrue
use_torch_compileBOOLEANtrue首次编译需30-60秒但后续快2-3倍。12GB显存建议关闭以避免OOM
use_xformersBOOLEANtruexFormers 注意力 (10-45% 加速)。未安装时回退到 SDPA
clipoptCLIP连接后仅加载模型本体(~5GB),使用此外部 CLIP,省显存
vaeoptVAE连接后仅加载模型本体(~5GB),使用此外部 VAE,省显存

Outputs (3)

NameTypeDescription
modelMODEL
clipCLIP
vaeVAE