Nodes/ComfyUI_SGLDiffusion_Fix/SGLDiffusion UNET Loader
ComfyUI Node

SGLDiffusion UNET Loader

Swap in this loader and SGLang owns the sampling

By endman100·Created 5 months ago·Updated 5 months ago· 0
SGLDiffusion UNET Loader
  • sgld_options
  • MODEL
unet_name
weight_dtype

The heart of Integrated Mode - and the reason this pack exists

SGLDiffusion UNET Loader is the node the whole Integrated Mode revolves around. In server mode you offload generation to a remote process; here the loader brings SGLang into your ComfyUI process and hands it the denoising entirely. The README's pitch is a one-line swap: take a workflow that uses the official UNET Loader, replace it with this node, and SGLang's optimized kernels take over the sampling. For big models - FLUX especially - that's the difference between minutes and a lot less than minutes, with tensor parallelism and TeaCache doing the heavy lifting.

How it works

Load a .safetensors (or diffusers-format) diffusion model and the node starts an SGLang Diffusion generator around it, in comfyui_mode. The model you get back is a special patcher whose load/patch methods are effectively no-ops, because SGLang owns the sampling path - ComfyUI's own KSampler sits in the graph but the actual denoising happens inside SGLang. Everything around it (CLIP, VAE, conditioning, decode) stays standard ComfyUI, which is what makes the swap so clean.

If the model type has no SGLang pipeline - say you load an Anima or some other architecture it doesn't recognize - the loader quietly falls back to native mode and runs it through plain ComfyUI instead. That safety net means the node never hard-fails on an unknown model; you just don't get the speedup.

The inputs that matter

  • unet_name - a dropdown of everything in ComfyUI/models/diffusion_models/. Your FLUX, Z-Image-Turbo, or Qwen-Image checkpoint goes here.
  • weight_dtype - default, fp8_e4m3fn, or fp8_e5m2. The fp8 options quantize the weights to 8-bit floating point: roughly half the VRAM of fp16 with near-zero visible quality loss, and e4m3fn is the variant everyone actually means when they say fp8. If your card is 12–24GB and the model won't fit otherwise, this is the lever.
  • sgld_options - optional, from the SGLDiffusion Options node. Leave it disconnected and everything runs on sensible defaults; connect it once you need multi-GPU or model-type overrides.

The output is a MODEL - wire it into your sampler exactly like any loader.

Gotchas

The first load initializes the generator and spawns SGLang's worker processes, which is heavy and can look hung; give it time. There's a memory model at work too - the patcher tells ComfyUI to reserve a fixed model size (roughly 27GB for FLUX) rather than computing it, so watch your VRAM budget. And remember the pack itself doesn't install SGLang:

cd ComfyUI/custom_nodes
git clone https://github.com/endman100/ComfyUI_SGLDiffusion_Fix
pip install sglang[diffusion]

Restart ComfyUI after the clone. If you get an error about sglang.multimodal_gen on startup, that's the missing install - the whole pack degrades gracefully, but this node won't work without it. Load-time settings are baked into the running generator, so a change to options means reloading the model, not just rerunning the graph.

CategorySGLDiffusion

Inputs (3)

NameTypeDefaultDescription
unet_nameCOMBO0 options:
weight_dtypeCOMBO3 options: default, fp8_e4m3fn, fp8_e5m2
sgld_optionsoptSGLD_OPTIONS

Outputs (1)

NameTypeDescription
MODELMODEL