ComfyUI Node
SonarWaveletCFG
Wavelet CFG function that allows you to apply different CFG strength to different frequencies.
SonarWaveletCFG
- model
- operation_cond
- operation_uncond
- operation_fallback_cfg
- operation_wavelet_cfg
- operation_result
- MODEL
◄start_sigma-1.000►
◄end_sigma0.000►
◄fallback_modeexisting►
◄blend_modelerp►
◄blend_strength1.000►
◄yaml_parameters# YAML or JSON here.
# I recommend reading the documentation at https://github.com/blepping/ComfyUI-sonar/docs/waveletcfg.md
# For wavelet information, see: https://pytorch-wavelets.readthedocs.io/en/latest/index.html
# You may override the fields from the node like start_sigma here.
# This section is basically the CFG scale. (All scales sections use the same format.)
difference:
# Scale for the low frequency components.
yl_scale: 5.0
# Scale (or scales) for high frequency components.
# This can be scalar or a list or list of lists.
# List example:
# yh_scales:
# - [1, 2, 3]
# - fill
# - 5
# You can separately apply a scale to items equal to the wavelet level. Levels go from fine to coarse.
# If the item is a list, the three items correspond to horizontal, vertical, diagonal for DWT. (DTCWT has 6.)
# You can have one "fill" item, this will replicate the item before it however many times is necessary to
# match the wavelet level.
yh_scales: 3.0
# You can optionally include a scales_end block with yl_scale/yh_scales.
# to interpolate from the toplevel scales (can also be in a scales_start blockx if you prefer).
# scales_end:
# yl_scale: 1.0
# yh_scales: 1.0
# The following scheduling parameters only apply if scales_end exists.
# One of linear, logarithmic, exponential, half_cosine, sine
# Sine mode will hit the peak scales_after values in the middle of the range.
schedule: linear
# One of: sampling, enabled_sampling, sigmas, enabled_sigmas, step, enabled_steps
schedule_mode: sampling
# When enabled, flips the schedule percentage. This happens before the schedule is applied
# or any offset/multiplier stuff. If you want to flip the final result you can do something like
# schedule_offset_after: -1.0 and schedule_multiplier_after: -1.0
reverse_schedule: false
# Added to the percentage before the schedule function is applied.
schedule_offset: 0.0
# Applied to the percentage before the schedule function (but after the offset).
schedule_multiplier: 1.0
# Added to the percentage after the schedule function is applied.
schedule_offset_after: 0.0
# Applied to the percentage after the schedule function (but after the offset).
schedule_multiplier_after: 1.0
# Min/max for the final calculated percent. Must be between 0 and 1.
schedule_min: 0.0
schedule_max: 1.0
# If you're a crazy person, you can use non-standard blend modes for interpolating
# the scales. Not recommended.
blend_mode: lerp
# Wavelet type
wave: db4
# Wavelet level
level: 5
### Start of advanced options
# Mode used for padding
padding_mode: symmetric
# Mutually exclusive with DTCWT mode.
use_1d_dwt: false
# Enables DTCWT mode.
use_dtcwt: false
# Configuration for DTCWT, only relevant when enabled.
biort: near_sym_a
qshift: qshift_a
# It's also possible to set these wavelet options with an "inv_"
# prefix: mode, biort, qshift, wave, padding_mode
# One of: noise_norm, noise, denoised
# Normal CFG uses denoised mode. noise_norm divides by the current sigma, noise just uses the raw noise prediction.
target_mode: denoised
# Can be used to scale cond before the difference is calculated.
cond:
yl_scale: 1.0
yh_scales: 1.0
# Can be used to scale uncond before the difference is calculated.
uncond:
yl_scale: 1.0
yh_scales: 1.0
# Can be used to scale the final result after blending.
final:
yl_scale: 1.0
yh_scales: 1.0
# Uses float64 for the wavelets/scaling/blending operations.
# It doesn't seem to hurt performance much, but you can disable it if you want.
high_precision_mode: true
# Inject is just addition which is usually what you want. The normal CFG function is:
# uncond + (cond - uncond) * cfg_scale
difference_blend_mode: inject
difference_blend_strength: 1.0
# Per-rule value, can be enabled to spam your console with information when
# rules activate, dump exactly what high/low scales are used, etc.
verbose: false
# You may include a rules block which is a list of these configuration definitions.
# Include start_sigma/end_sigma parameters. The first matching definition will be used.
# rules:
# - start_sigma: -1.0
►
Categorymodel_patches
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| start_sigma | FLOAT | -1.000-1–10000 | First sigma wavelet CFG will be used. |
| end_sigma | FLOAT | 0.0000–10000 | Last sigma wavelet CFG will be used. |
| fallback_mode | COMBO | existing | Existing mode uses whatever CFG function existed set when this model patch was applied. Own mode does the CFG calculation on its own. The scale will be whatever you set in your guider or sampler. |
| blend_mode | COMBO | lerp | Controls how the result from wavelet CFG is blended with normal CFG. The default of LERP with strength 1.0 uses 100% wavelet CFG. |
| blend_strength | FLOAT | 1.000-10000–10000 | Controls how the result from wavelet CFG is blended with normal CFG. The default of LERP with strength 1.0 uses 100% wavelet CFG. |
| yaml_parameters | STRING | # YAML or JSON here. # I recommend reading the documentation at https://github.com/blepping/ComfyUI-sonar/docs/waveletcfg.md # For wavelet information, see: https://pytorch-wavelets.readthedocs.io/en/latest/index.html # You may override the fields from the node like start_sigma here. # This section is basically the CFG scale. (All scales sections use the same format.) difference: # Scale for the low frequency components. yl_scale: 5.0 # Scale (or scales) for high frequency components. # This can be scalar or a list or list of lists. # List example: # yh_scales: # - [1, 2, 3] # - fill # - 5 # You can separately apply a scale to items equal to the wavelet level. Levels go from fine to coarse. # If the item is a list, the three items correspond to horizontal, vertical, diagonal for DWT. (DTCWT has 6.) # You can have one "fill" item, this will replicate the item before it however many times is necessary to # match the wavelet level. yh_scales: 3.0 # You can optionally include a scales_end block with yl_scale/yh_scales. # to interpolate from the toplevel scales (can also be in a scales_start blockx if you prefer). # scales_end: # yl_scale: 1.0 # yh_scales: 1.0 # The following scheduling parameters only apply if scales_end exists. # One of linear, logarithmic, exponential, half_cosine, sine # Sine mode will hit the peak scales_after values in the middle of the range. schedule: linear # One of: sampling, enabled_sampling, sigmas, enabled_sigmas, step, enabled_steps schedule_mode: sampling # When enabled, flips the schedule percentage. This happens before the schedule is applied # or any offset/multiplier stuff. If you want to flip the final result you can do something like # schedule_offset_after: -1.0 and schedule_multiplier_after: -1.0 reverse_schedule: false # Added to the percentage before the schedule function is applied. schedule_offset: 0.0 # Applied to the percentage before the schedule function (but after the offset). schedule_multiplier: 1.0 # Added to the percentage after the schedule function is applied. schedule_offset_after: 0.0 # Applied to the percentage after the schedule function (but after the offset). schedule_multiplier_after: 1.0 # Min/max for the final calculated percent. Must be between 0 and 1. schedule_min: 0.0 schedule_max: 1.0 # If you're a crazy person, you can use non-standard blend modes for interpolating # the scales. Not recommended. blend_mode: lerp # Wavelet type wave: db4 # Wavelet level level: 5 ### Start of advanced options # Mode used for padding padding_mode: symmetric # Mutually exclusive with DTCWT mode. use_1d_dwt: false # Enables DTCWT mode. use_dtcwt: false # Configuration for DTCWT, only relevant when enabled. biort: near_sym_a qshift: qshift_a # It's also possible to set these wavelet options with an "inv_" # prefix: mode, biort, qshift, wave, padding_mode # One of: noise_norm, noise, denoised # Normal CFG uses denoised mode. noise_norm divides by the current sigma, noise just uses the raw noise prediction. target_mode: denoised # Can be used to scale cond before the difference is calculated. cond: yl_scale: 1.0 yh_scales: 1.0 # Can be used to scale uncond before the difference is calculated. uncond: yl_scale: 1.0 yh_scales: 1.0 # Can be used to scale the final result after blending. final: yl_scale: 1.0 yh_scales: 1.0 # Uses float64 for the wavelets/scaling/blending operations. # It doesn't seem to hurt performance much, but you can disable it if you want. high_precision_mode: true # Inject is just addition which is usually what you want. The normal CFG function is: # uncond + (cond - uncond) * cfg_scale difference_blend_mode: inject difference_blend_strength: 1.0 # Per-rule value, can be enabled to spam your console with information when # rules activate, dump exactly what high/low scales are used, etc. verbose: false # You may include a rules block which is a list of these configuration definitions. # Include start_sigma/end_sigma parameters. The first matching definition will be used. # rules: # - start_sigma: -1.0 | Allows specifying custom parameters via YAML. Note: When specifying paramaters this way, there is generally not much error checking. |
| operation_condopt | LATENT_OPERATION | Optional latent operation that will be applied to cond. Note: Latent operations only apply if a rule matches. | |
| operation_uncondopt | LATENT_OPERATION | Optional latent operation that will be applied to uncond. Note: Latent operations only apply if a rule matches. | |
| operation_fallback_cfgopt | LATENT_OPERATION | Optional latent operation that will be applied to the fallback (non-wavelet) CFG result. Note: Latent operations only apply if a rule matches. | |
| operation_wavelet_cfgopt | LATENT_OPERATION | Optional latent operation that will be applied to wavelet CFG result. Note: Latent operations only apply if a rule matches. | |
| operation_resultopt | LATENT_OPERATION | Optional latent operation that will be applied to the final result, after wavelet and normal CFG are potentially blended. Note: Latent operations only apply if a rule matches. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |