SGLDiffusion Options
Where SGLang's server knobs leak into ComfyUI
- sgld_options
The config node you mostly ignore - until you need it
SGLDiffusion Options is the Integrated Mode's control panel. It takes no inputs, has one output (sgld_options), and exists to feed launch settings into the SGLDUNETLoader before SGLang spins up. Every single input is optional, and that's the first thing to internalize: for a single GPU, default options, SGLang picks sensible values on its own. This node is there for when "sensible" isn't what you want.
In Integrated Mode, the SGLDUNETLoader actually starts an SGLang Diffusion generator inside your ComfyUI process. That means all the flags you'd normally type when launching an SGLang server by hand get surfaced here as widgets instead. It's a translation layer between a serving stack and a node graph, and it shows.
The inputs that actually matter
- model_type -
auto-detectby default, orqwen_image,qwen_image_edit,flux,lumina2. Auto-detect reads the checkpoint and figures it out; you only override it when detection gets it wrong or you're loading something ambiguous.lumina2is SGLang's internal name for Z-Image, if you're wondering. - num_gpus - how many GPUs the integrated generator gets. Default 1. The single biggest lever if you have multiple cards.
- tp_size - tensor parallelism: shards the model across GPUs. Default ‑1 means "SGLang decides." Set it when auto-detection picks something silly for your card count.
- enable_cfg_parallel - runs the positive and negative CFG passes on separate devices, roughly doubling throughput on multi-GPU setups. Free speed if you have the hardware, pointless if you don't.
- sp_degree / ulysses_degree / ring_degree - sequence-parallel knobs for long sequences (read: long video). All default to ‑1/auto. Leave them alone until you're chasing a specific memory or speed wall.
- enable_torch_compile - compiles the model graph on load. Real speedup, real load-time hit, occasional compatibility pain. Benchmark before you adopt it.
- attention_backend - string, default empty. Lets you force a backend (e.g., FlashAttention) when you have an opinion; empty means SGLang picks.
- dp_size / dp_degree - data-parallel settings for batching. Not something the typical single-user ComfyUI session needs.
How to use it
Wire the sgld_options output into the optional input on SGLDUNETLoader, set num_gpus to match your hardware, and resist touching the rest until you hit a wall. The honest advice: 90% of users should leave everything at default and revisit only if generation is slower than it should be or a model fails to initialize. When it does fail to initialize, the model_type override and a manual attention_backend are the first two things worth trying.
Install
Shared with the pack - clone, restart, and install SGLang yourself since the pack carries no requirements:
cd ComfyUI/custom_nodes
git clone https://github.com/endman100/ComfyUI_SGLDiffusion_Fix
pip install sglang[diffusion]
One warning that applies here more than anywhere: these options get baked into the SGLang process when the model loads. Change num_gpus or tp_size and the generator may need to be re-created rather than picking it up live - when in doubt, restart ComfyUI after a big config change.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| model_typeopt | COMBO | auto-detect | 5 options: auto-detect, qwen_image, qwen_image_edit, flux, lumina2 |
| enable_torch_compileopt | BOOLEAN | false | — |
| num_gpusopt | INT | 1 | — |
| tp_sizeopt | INT | -1 | — |
| sp_degreeopt | INT | -1 | — |
| ulysses_degreeopt | INT | -1 | — |
| ring_degreeopt | INT | -1 | — |
| dp_sizeopt | INT | 1 | — |
| dp_degreeopt | INT | 1 | — |
| enable_cfg_parallelopt | BOOLEAN | false | — |
| attention_backendopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| sgld_options | SGLD_OPTIONS | — |