Extensions/DPM++ 2M Sharp for Qwen Image 2.1
ComfyUI Extension

DPM++ 2M Sharp for Qwen Image 2.1

A better sampler for Qwen Image 2.1: DPM++ 2M with adjustable denoised-history sharpening.

By envy-ai·Created 21 days ago·Updated 7 days ago· 6
envy-ai/ComfyUI-DPMpp-2M-Sharp
Nodes2
On cloudLocal install
Categorymodel/sampling/samplers
Stars6
Updated7 days ago
Readme

DPM++ 2M Sharp

A better sampler for Qwen Image 2.1, with adjustable sharpening of the denoised history used by DPM++ 2M.

The sampler progressively scales the previous denoised prediction before the next multistep update. It preserves the original DPM++ 2M step count and model-call count. Results depend on the prompt, model, and settings; this repository does not include a comparative benchmark.

The same history adjustment is also available as DPM++ 2M SDE GPU Sharp, preserving ComfyUI's SDE update and seeded GPU Brownian noise. Its image quality has not been comparatively tested.

The dpmpp_2m_fixed, dpmpp_2m_sharp_fixed, dpmpp_2m_sde_gpu_sharp_fixed, and dpmpp_3m_sde_gpu_sharp_fixed choices bundle the corresponding research sampler implementations from research-unipc-dpmpp. They retain its model-aware half-log-SNR handling, noise behavior, and 3M warmup. Both deterministic 2M choices default to eta = 0 and construct no Brownian noise sampler; dpmpp_2m_fixed ignores the provider's sharpness input. These are experimental variants; the _fixed names do not imply a comparative image-quality guarantee.

SEEDS_2 Sharp applies an analogous adjustment to the difference between its two stage predictions. It leaves the intermediate predictor unscaled and keeps native seeded noise, model-call count, and the final zero-sigma denoising step. At sharpness = 0.0 it matches native SEEDS_2. This is experimental and has not been comparatively benchmarked.

Experimental RES choices are res_2s_nc, res_2m_nc, res_2s_nc_sharp, and res_2m_nc_sharp. All four skip RES4LYF's final clean-latent correction, retaining the latent at the minimum positive sigma with a small amount of residual noise. They keep the minimum-sigma insertion and all positive-sigma model evaluations. RES 2M Sharp scales cached denoised history; RES 2S Sharp scales the first prediction only when combining its two stage predictions, preserving the unscaled intermediate predictor. Their image quality has not been comparatively tested.

Install

Search for DPM++ 2M Sharp for Qwen Image 2.1 in ComfyUI Manager, or install from the registry:

comfy node install dpmpp-2m-sharp

For a manual install, run this from your ComfyUI directory:

git clone https://github.com/envy-ai/ComfyUI-DPMpp-2M-Sharp custom_nodes/ComfyUI-DPMpp-2M-Sharp

Restart ComfyUI after installation. The package uses ComfyUI's V3 node API and its existing PyTorch, NumPy, and tqdm dependencies. All sampler and scheduler choices work without additional node packs or core modifications. The default RES 2S/2M, research 2M/3M, and Qwen quadratic scheduler implementations are bundled here; RES4LYF, research-unipc-dpmpp, and ComfyUI-Quadratic-Schedulers are not required.

Use

  1. Add Sampler DPM++ 2M Sharp from model/sampling/samplers.
  2. Select a DPM++, research _fixed, RES, or SEEDS_2 sampler using sampler_name.
  3. Connect its SAMPLER output to SamplerCustom or SamplerCustomAdvanced, using your existing model, conditioning, noise, latent, and sigma schedule.
  4. Start with sharpness = 0.15. Set it to 0.0 to disable the history adjustment; the SDE variant then matches ordinary DPM++ 2M SDE GPU. Larger values strengthen the history adjustment and may introduce artifacts.

For RES, sharpness = 0.0 makes each Sharp variant match its corresponding _nc variant. The two RES choices without _sharp ignore the sharpness input. Both Sharp RES choices also omit the final correction.

For manual SEEDS_2 controls, add Sampler SEEDS_2 Sharp and connect its SAMPLER output to SamplerCustom or SamplerCustomAdvanced. It retains all native controls: solver_type (phi_1 or phi_2), eta (default 1.0), s_noise (default 1.0), and r (default 0.5), and adds sharpness (default 0.15). The native advanced controls retain their usual widget settings. Set eta = 0.0 for deterministic sampling.

Use SamplerCustomAdvanced's output for NC comparisons; denoised_output comes from the preview prediction rather than the returned NC latent.

The node ID remains SamplerDPMPP_2M_Sharp. Existing workflows default to dpmpp_2m_sharp. This package exposes sampler provider nodes and adds dpmpp_2m_sde_gpu_sharp, all four research _fixed choices, seeds_2_sharp, and all four RES choices to the standard KSampler dropdown. Sharp variants use sharpness = 0.15. RES retains the original default noise strength of 0.5 for both steps and intermediate stages.

The research choices were formerly named research_dpmpp_2m, research_dpmpp_2m_sharp, research_dpmpp_2m_sde_gpu_sharp, and research_dpmpp_3m_sde_gpu_sharp in research-unipc-dpmpp. An updated research-unipc-dpmpp registers those old names as runtime aliases to this pack's corresponding _fixed samplers, preserving existing workflows when both packs are installed. Either pack can load first. This pack remains independent and does not require research-unipc-dpmpp.

Schedulers

Select qwen_21_turbo_custom or qwen_21_turbo in the standard KSampler scheduler dropdown and set steps normally; no additional nodes are needed.

| Scheduler | Eight-step sigmas | | --- | --- | | qwen_21_turbo_custom | 0.9786, 0.9750, 0.9520, 0.8903, 0.7898, 0.6505, 0.4724, 0.2556, 0 | | qwen_21_turbo | 1, 0.978453, 0.95418, 0.926626, 0.89508, 0.845148, 0.704534, 0.414568, 0 |

Other step counts sample the same smooth, monotone piecewise quadratic curve at evenly spaced positions. The first slope is zero and adjacent segments share their slope at each anchor. Each schedule contains steps + 1 CPU float32 sigmas, including the final zero. One step uses the first sigma followed by zero; zero steps returns only zero. These absolute Qwen sigmas are not scaled to the model's sigma range. Partial denoising follows normal KSampler behavior.

The names and schedules are unchanged from ComfyUI-Quadratic-Schedulers. Existing workflows can use this pack alone; keeping both packs installed does not duplicate scheduler choices.

Tests

From the ComfyUI directory, run python -m pytest --import-mode=importlib custom_nodes/ComfyUI-DPMpp-2M-Sharp/tests. Tests cover standalone RES loading and execution, sampler and scheduler registration, exact Qwen scheduler values, seeded noise, and zero-sharpness behavior. Optional comparisons against the locally updated RES4LYF pack check its original sampling paths across EPS/flow models and several schedules; these comparisons skip when that pack is absent.

License and credits

The DPM++ and SEEDS_2 modifications are GPL-3.0; see LICENSE. They are adapted from ComfyUI's DPM++ 2M and SEEDS_2 implementations, based on k-diffusion. SEEDS is described in Stochastic Exponential Integrators for Diffusion Models. The k-diffusion MIT notice is included in LICENSE.k-diffusion.

The bundled RES implementation in res.py is adapted from the default beta sampler paths in RES4LYF, including the locally added NC/Sharp variants. Its upstream license is preserved in LICENSE.RES4LYF: AGPL-3.0 with an additional restriction on commercial services. The rest of RES4LYF's samplers, guides, and options are not bundled.

The research 2M/3M implementation in fixed.py is adapted from sampling_ext.py and multistep_math.py in research-unipc-dpmpp, copyright (c) 2026 Iakov Savelev. Its MIT notice is preserved in LICENSE.research-unipc-dpmpp. Unrelated research samplers are not bundled.

The quadratic schedulers in schedulers.py are adapted from ComfyUI-Quadratic-Schedulers, copyright (c) 2026 Bart. Its MIT notice is preserved in LICENSE.Quadratic-Schedulers.