ComfyUI Extension: ComfyUI-ppm

Authored by pamparamm

Created

Updated

177 stars

Fixed AttentionCouple, NegPip(negative weights in prompts) for SDXL and FLUX, more CFG++ and SMEA DY samplers, etc.

README

ComfyUI-ppm

Just a bunch of some random nodes modified/fixed/created by me and/or others. If any node starts throwing errors after an update - try to delete and re-add the node.

You can browse example workflows inside ComfyUI's "Browse Templates/Custom Nodes/ComfyUi-ppm" menu. I'll probably add some more examples in future (but I'm kinda lazy, kek).

Nodes

CLIPNegPip

Allows you to use negative weights in prompts. Negative weights can be used in both CFG models (such as SDXL) and Guidance-Distilled models (such as Flux) to negate a concept or a trait.

Supports:

  • SD1
  • SDXL
  • FLUX
  • HunyuanVideo
  • HunyuanVideoI2V

Modified implementation of NegPiP by laksjdjf and hako-mikan. It uses ModelPatcher instead of monkey-patching, which should increase compatibility with other nodes.

You can read more about NegPiP in the original repo. When used together with tag-based models, you should keep all commas inside weight braces (i.e. (worst quality,:-1.3) (sketch,:-1.1) instead of (worst quality:-1.3), (sketch:-1.1),).

[!NOTE] CLIPNegPip is compatible with:

CLIPNegPip is incompatible with:

AttentionCouplePPM

Modified implementation of AttentionCouple by laksjdjf and Haoming02, made to be more compatible with other custom nodes.

Inputs for new regions are managed automatically: when you attach cond/mask of a region to the node, a new cond_ / mask_ input appears. Last cond_ / mask_ inputs are always optional.

You can use multiple LatentToMaskBB nodes to set bounding boxes for AttentionCouplePPM. The parameters are relative to your initial latent: x=0.5, y=0.0, w=0.5, h=1.0 will produce a mask covering the right half of the image.

DynSamplerSelect

Modified samplers from Euler-Smea-Dyn-Sampler by Koishi-Star.

Contains some new samplers: euler_ancestral_dy, dpmpp_2m_dy and dpmpp_3m_dy.

Tweaking s_dy_pow may reduce blur artifacts (optimal value is 2 for euler_* samplers and -1 for dpmpp_* samplers, use -1 to disable this feature).

CFG++SamplerSelect

Samplers adapted to CFG++: Manifold-constrained Classifier Free Guidance for Diffusion Models by Chung et al.. Also contains converted samplers from Euler-Smea-Dyn.

Should greatly reduce overexposure effect. Use together with SamplerCustom node. Don't forget to set CFG scale to 1.0-2.0 and PAG/SEG scale (if used) to 0.5-1.0.

Guidance Limiter

Implementation of Applying Guidance in a Limited Interval Improves Sample and Distribution Quality in Diffusion Models by Kynkäänniemi et al. as a post CFG function.

Guidance Limiter is also available as a CFGLimiterGuider guider node for SamplerCustomAdvanced.

Post-CFG nodes

Post-CFG variants of some nodes - they should have increased compatibility with other CFG-related nodes, making it possible to chain them together:

Empty Latent Image (Aspect Ratio)

Generates empty latent with specified aspect ratio and with respect to target resolution.

CLIPTextEncodeBREAK

A small lightweight wrapper over ConditioningConcat node. It splits prompts into chunks by BREAK keyword and produces a single concatenated conditioning.

CLIPTokenCounter

Counts tokens in your prompt and returns them as a string (currently limited to clip_l). You can also print token count + individual tokens by enabling debug_print.

Hooks/Hijacks

Schedulers

Adds some schedulers to the default list from ComfyUI by replacing comfy.samplers.calculate_sigmas function: