Nodes/ComfyUI-Magic-Assistant/🎲 SDNQ K采样器 Magic SDNQ K Sampler
ComfyUI Node

🎲 SDNQ K采样器 Magic SDNQ K Sampler

An SDNQ sampler that doubles as a normal KSampler when it needs to

By shigjfg·Created 8 months ago·Updated 11 days ago· 37
🎲 SDNQ K采样器 Magic SDNQ K Sampler
  • model
  • positive
  • negative
  • latent
  • latent
seed0
steps25
cfg7.0
schedulerFlowMatchEulerDiscreteScheduler
降噪1.00
预览方式auto
attention_slicingnone
chunk_attentiondisable
采样模式SDNQ
sampler_nameeuler
comfy_schedulernormal

If Magic SDNQ Loader hands you the quantized model, this is the node that actually generates with it. Magic SDNQ K Sampler is a drop-in KSampler replacement for SDNQ models - model, positive, negative, latent in, latent out - with real-time progress and previews like the official node. But it has a party trick worth knowing before you wire anything: a sampler mode switch that lets it fall back to ComfyUI's official KSampler for non-SDNQ models, which makes it a reasonable universal sampler on its own.

The two modes

  • SDNQ - SDNQ models only, sampled through the diffusers pipeline. Feed it a non-SDNQ model in this mode and it raises a clear error telling you to switch modes. Annoying by design, actually helpful: it stops silent nonsense.
  • SDNQ + KSampler - auto-detects. SDNQ models take the SDNQ path; anything else (a CheckpointLoader result, say) gets routed to ComfyUI's official KSampler logic. In this mode the sampler_name (44 choices) and comfy_scheduler (9 choices) inputs become live, and the node genuinely works as a general KSampler.

Inputs that matter

The required set is the KSampler standard: model, positive, negative, latent, then seed, steps, cfg, and a scheduler list for the SDNQ path. The scheduler tooltip is the cheat sheet: FlowMatch for FLUX/SD3/Qwen, DPM or Euler for SDXL/SD1.5. That matches the flow-matching reality - modern models want the flow-matching scheduler and low CFG, while SDXL-lineage stays on classic settings.

Then a few SDNQ-specific knobs that read like a low-VRAM toolkit:

  • 降噪 (denoise, 0–1) - the img2img strength dial
  • 预览方式 - auto / latent2rgb (fast) / taesd (slower, clearer) / none
  • attention_slicing - slices attention to cut peak VRAM (none/auto/1/2/1/4/1/8), trading speed
  • chunk_attention - chunks the KV cache (disable/32/64/128/256); 32 is most VRAM-frugal, 128 fastest-with-chunking

One output: latent.

What the changelog gives you

Three behaviors are worth knowing because they solve real problems:

  • Inpainting works. Use ComfyUI's InpaintModelConditioning + SetLatentNoiseMask as usual; 3D packed models (Flux, Flux2) blend in pixel space for natural results, 4D latent models (SDXL) blend in latent space for speed. The V1.2.3 update fixed txt2img/img2img stability and the V1.2.2 fix for undersized txt2img output is in.
  • VRAM hygiene. The sampler calls ComfyUI's load_models_gpu/free_memory before sampling, so on a 12GB card it can offload other models first - the fix for OOM that isn't the sampler's fault.
  • Size compensation. Packed-latent pipelines (FLUX and friends) get their output-size handling corrected internally, so a 1024×1536 request comes back at 1024×1536, not half of it. That was a whole genre of bug reports before it was fixed.

Pairing it with the pack

The README's performance notes: under 1024×1536, single-image edit or txt2img can land in roughly 10–20 seconds on a 3060, and wiring the pack's Magic Cache node after the loader adds another ~1.5–2x. Cache is optional, but it's a one-node addition, so why not.

Installing

It's part of the Magic-Assistant pack, and it needs the same SDNQ environment as the loader:

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

Restart, find it under "✨ Magic Assistant". Lazy-loading means the pack installs fine even if you skip the SDNQ deps - the sampler just won't work until you add them. Set the 采样模式 to "SDNQ + KSampler" from the start unless you're certain you'll only ever feed it SDNQ models; it costs nothing and saves you the error later.

Category✨ Magic Assistant

Inputs (15)

NameTypeDefaultDescription
modelMODEL来自 Magic SDNQ Loader、LoRA Loader 或其他模型加载器
positiveCONDITIONING正面条件
negativeCONDITIONING负面条件
latentLATENT空 latent
seedINT0-1–18446744073709550000
stepsINT251–150
cfgFLOAT7.00–30
schedulerCOMBOFlowMatchEulerDiscreteSchedulerSDNQ 模式的调度器。FLUX/SD3/Qwen 用 FlowMatch; SDXL/SD1.5 用 DPMSolver/Euler
降噪FLOAT1.000–1
预览方式COMBOautoauto=自动, latent2rgb=快, taesd=慢但更清晰, none=不预览
attention_slicingCOMBOnone分块计算注意力,减少峰值显存但会变慢。none=禁用(快), auto=自动, 1/2=一半一半算(最省显存)
chunk_attentionCOMBOdisable分块处理 KV Cache。disable=正常(快), 32=最省显存, 64=平衡, 128=较快
采样模式COMBOSDNQSDNQ=仅支持 SDNQ 模型; SDNQ + KSampler=同时兼容其他模型(自动判定)
sampler_nameoptCOMBOeuler官方 KSampler 的采样器(仅 SDNQ + KSampler 模式下对非 SDNQ 模型生效)
comfy_scheduleroptCOMBOnormal官方 KSampler 的调度器(仅 SDNQ + KSampler 模式下对非 SDNQ 模型生效)

Outputs (1)

NameTypeDescription
latentLATENT