Qwen SEGA Sampler
Frequency-Steered Qwen-Image in One Node Instead of a Fork
- model
- positive
- latent_image
- sega_settings
- negative
- latent
This is the node that does the work. QwenSEGASampler is a drop-in replacement for KSampler in a Qwen-Image graph - same MODEL / CONDITIONING / LATENT in, LATENT out - except it runs a SEGA-style frequency steering pass on every denoising step. Qwen-Image is Alibaba's 20B MMDiT (Apache 2.0, brilliant with text and prompts, occasionally soft in the details), and this pack's whole pitch is: measure where the latent's spectral energy is concentrated, then rescale Qwen's RoPE embeddings so attention focuses accordingly. It's a "make the details crisper" experiment you bolt onto a normal T2I workflow, not a replacement for the model.
How it works
Nothing here is a new diffusion model. The sampler:
- Validates that your model's diffusion core is
QwenImageTransformer2DModel- it will refuse SDXL, Flux, anything else. - Clones the model and installs two patches: one hooks the per-step conditioning batch function to FFT the current latent and build a per-frequency RoPE scale vector; the other applies that scaling to the rotary embeddings before Qwen's attention runs.
- Hands off to ComfyUI's normal
comfy.sample.samplepath - the same sampler, scheduler, and CFG machinery you already know.
That last point is why it feels sane to use. The sampler and scheduler lists are ComfyUI's stock enums, so euler / simple defaults just work and anything other packs register into SAMPLER_NAMES shows up too. The magic - and the VRAM cost - is the per-step FFT, which is why the README warns that 4096×4096 is likely VRAM-bound on most systems.
Inputs that matter
- model, positive, latent_image - wire these exactly like a KSampler: load a native Qwen-Image model through ComfyUI, text-encode, and feed an Empty Latent.
negativeis optional, as on any CFG sampler. - sega_settings (required) - the reason the pack has two nodes. Feed it the
sega_settingsoutput from Qwen SEGA Settings. Forgetting it is the easiest way to get a red connection. - seed, steps, cfg - defaults are 0 / 30 / 4. Qwen-Image runs happy around CFG 3–5, so the default 4 is a fine starting point; bump steps if you're chasing fine detail.
- sampler_name, scheduler - stock ComfyUI enums. Only the attention path is modified, so reach for Karras or an ancestral sampler freely.
- add_noise - advanced toggle; leave it on.
The output
latent (LATENT) - a normal latent, nothing exotic. Pipe it into VAE Decode → Save Image like any other sampler. That's the pack's cleanest design decision: no weird intermediate types to learn.
Installing it
Identical to its sibling node - ComfyUI Manager (search "comfyui-qwen-sega") or clone into custom_nodes, then:
pip install -r requirements.txt # just numpy
Restart, and make sure your ComfyUI is recent enough to have native Qwen-Image support - on an older build the sampler will throw at validation because the diffusion model class won't match.
Where people get burned
- Wrong model = instant refusal. The validation error literally names the diffusion class it found. Plug in Flux or SDXL and you get an error, not silent garbage - which is honestly the polite way to fail.
- It's an approximation, not a port. The README says it plainly: this is a ComfyUI-native take on SEGA on top of Qwen's existing RoPE path, not a byte-for-byte reimplementation of the upstream diffusers version. Expect qualitative sharpening, not research-grade parity.
- VRAM. Per-step FFT plus Qwen attention at high resolution adds real peak memory. Quantized (fp8/q8/q4) weights may work but are explicitly unvalidated by the author.
- Patch conflicts. Any other custom node that overrides
attn1can interact unpredictably. If you're stacking attention-patching nodes, budget time for debugging. - Batch > 1 isn't the target. Keep it at 1.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| positive | CONDITIONING | — | |
| latent_image | LATENT | — | |
| seed | INT | 00–18446744073709550000 | — |
| steps | INT | 301–10000 | — |
| cfg | FLOAT | 4.00–100 | — |
| sampler_name | COMBO | euler | 44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38 |
| scheduler | COMBO | simple | 9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3 |
| sega_settings | SEGA_SETTINGS | — | |
| add_noise | BOOLEAN | true | — |
| negativeopt | CONDITIONING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |