ComfyUI Extension: comfyui-qwen-sega

Authored by ventacom

Created

Updated

0 stars

Run ComfyUI workflows without the setup

No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.

Native ComfyUI integration of SEGA-style Qwen-Image sampling.

Looking for a different extension?

Custom Nodes (2)

README

ComfyUI-Qwen-SEGA

Native ComfyUI integration of SEGA-style Qwen-Image sampling.

This package does not launch external scripts, does not load model weights inside the node, and returns a normal LATENT for downstream VAE Decode and Save Image nodes.

Scope

MVP supports:

  • Qwen-Image text-to-image
  • ComfyUI-loaded MODEL, CONDITIONING, and LATENT
  • Per-step latent FFT analysis inside the denoising path
  • Qwen attention RoPE patching through ComfyUI model patch APIs

Not in MVP:

  • Qwen-Image-Edit
  • image-to-image
  • multi-reference editing
  • masks
  • Flux support

Installation

  1. Copy this folder into ComfyUI/custom_nodes/ComfyUI-Qwen-SEGA.
  2. Install any missing Python deps in the ComfyUI environment:
pip install -r custom_nodes/ComfyUI-Qwen-SEGA/requirements.txt
  1. Restart ComfyUI.

Required ComfyUI Version

This node targets a recent ComfyUI build that includes native Qwen-Image support and the following internals:

  • comfy.ldm.qwen_image.model.QwenImageTransformer2DModel
  • ModelPatcher.set_model_sampler_calc_cond_batch_function
  • ModelPatcher.set_model_attn1_patch

If your build predates native Qwen-Image support, this package will not work.

Required Models

  • A native ComfyUI Qwen-Image diffusion model
  • The matching Qwen text encoder loaded through normal ComfyUI nodes
  • A compatible VAE loaded through normal ComfyUI nodes

This package does not bundle or download any model files.

Nodes

Qwen SEGA Settings

Builds a reusable SEGA_SETTINGS object.

Important controls:

  • sega_strength: overall patch intensity
  • sega_start_percent / sega_end_percent: active sampling window
  • frequency_mode: adaptive or fixed weighting bias
  • low_freq_weight / high_freq_weight: spectral weighting bias
  • rope_scale_min / rope_scale_max: clamp range for per-frequency RoPE rescaling

Qwen SEGA Sampler

Inputs:

  • model
  • positive
  • negative optional
  • latent_image
  • seed
  • steps
  • cfg
  • sampler_name
  • scheduler
  • sega_settings

Output:

  • LATENT

Graph

Recommended graph:

Load Diffusion Model -> Text Encode -> Empty Latent -> Qwen SEGA Sampler -> VAE Decode -> Save Image

Example Workflows

Example prompt graphs are in examples/qwen_sega_t2i_workflow.json and examples/qwen_baseline_comparison_workflow.json.

They are API-style workflow stubs intended as a starting point because node IDs and loader names vary across ComfyUI installs.

Performance Notes

  • The patch computes FFT-derived statistics from the current latent on every denoising step.
  • High resolutions amplify both FFT cost and Qwen attention cost.
  • 4096x4096 is likely VRAM-limited on many systems.

VRAM Notes

  • Expect higher peak memory than baseline Qwen sampling.
  • Quantized weights may still work, but this path has not been validated across every fp8/q8/q4 variant.

Known Limitations

  • The MVP uses a ComfyUI-native approximation of SEGA on top of Qwen’s existing RoPE path.
  • Qwen-Image-Edit and reference-image flows are not implemented yet.
  • Batch sizes greater than 1 are not the main target.

See docs/investigation.md, docs/design.md, and docs/limitations.md.

Run ComfyUI workflows without the setup

No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.

Learn more