Nodes/ComfyUI-sonar/SonarApplyLatentOperationCFG
ComfyUI Node

SonarApplyLatentOperationCFG

Allows applying a LATENT_OPERATION during sampling. ComfyUI has a few that are builtin and this node pack also includes: SonarLatentOperationQuantileFilter.

By blepping·Created 3 years ago·Updated 4 days ago· 49
SonarApplyLatentOperationCFG
  • model
  • operation_1
  • operation_2
  • operation_3
  • operation_4
  • operation_5
  • MODEL
modecond_sub_uncond
pred_flip_modefalse
require_uncondfalse
start_sigma-1.000
end_sigma0.000
blend_modelerp
blend_strength0.500
blend_scale_modereverse_sampling
blend_scale_offset0.000
blend_scale_min0.000
blend_scale_max1.000
immediate_blendfalse
Categorylatent/advanced/operations

Inputs (18)

NameTypeDefaultDescription
modelMODEL
modeCOMBOcond_sub_uncondcond_sub_uncond is what ComfyUI's latent operations use. The non-sub_uncond modes likely won't work with pred_flip mode enabled. If you have anything but the denoised options selected, this will use pre-CFG, otherwise it will use post-CFG (unless you are using model_input).
pred_flip_modeBOOLEANfalseLets you try to apply the latent operation to the noise prediction rather than the image prediction. Doesn't work properly with the non-sub_uncond modes. No real reason it should be better, just something you can try. Note: The noise prediction gets scaled by the sigma first, in case that's useful information.
require_uncondBOOLEANfalseWhen enabled, the operation will be skipped if uncond is unavailable. This will also happen if you choose a mode that requires uncond.
start_sigmaFLOAT-1.000-1–10000First sigma the effect becomes active. You can set a negative value here to use whatever the model's maximum sigma is.
end_sigmaFLOAT0.0000–10000Last sigma the effect is active.
blend_modeCOMBOlerpControls how the output of the latent operation is blended with the original result.
blend_strengthFLOAT0.500-10000–10000Strength of the blend. For a normal blend mode like LERP, 1.0 means use 100% of the output from the latent operation, 0.0 means use none of it and only the original value. Note: Blending is applied to the final result of the operations unless you enable immediate_blend, in other words operation_2 sees a full unblended result from operation_1.
blend_scale_modeCOMBOreverse_samplingCan be used to scale the blend strength over time. Basically works like blend_strength * scale_factor (see below) none: Just uses the blend_strength you have set. reverse_sampling: The opposite of the model sampling percent, so if you're making a new generation, the beginning of sampling will be 1.0 and the end will be 0.0. The recommended option as applying these operations usually works better toward the beginning of sampling. sampling: Same as reverse_sampling, except the beginning will be 0.0 and the end will be 1.0. reverse_enabled_range: Flipped percentage of the range between start_sigma and end_sigma. enabled_range: Percentage of the range between start_sigma and end_sigma. sampling_sin: Uses the sampling percentage with the sine function such that blend_strength will hit the peak value in the middle of the range. enabled_range_sin: Similar to sampling_sin except it applies to the percentage of the enabled range.
blend_scale_offsetFLOAT0.000-1–1Only applies when blend_scale_mode is not none. Adds the offset to the calculated percentage and then clamps it to be between blend_scale_min and blend_scale_max.
blend_scale_minFLOAT0.000-10000–10000Only applies when blend_scale_mode is not none. Minimum value for the blend scale percentage. Many blend modes don't tolerate negative values here.
blend_scale_maxFLOAT1.000-10000–10000Only applies when blend_scale_mode is not none. Maximum value for the blend scale percentage. Many blend modes don't tolerate values over 1.0 here.
immediate_blendBOOLEANfalseYou can enable this to do blending immediately after each latent operation is called. Mainly affects the case where you have multiple latent operations connected.
operation_1optLATENT_OPERATIONOptional LATENT_OPERATION. The operations will be applied in sequence.
operation_2optLATENT_OPERATIONOptional LATENT_OPERATION. The operations will be applied in sequence.
operation_3optLATENT_OPERATIONOptional LATENT_OPERATION. The operations will be applied in sequence.
operation_4optLATENT_OPERATIONOptional LATENT_OPERATION. The operations will be applied in sequence.
operation_5optLATENT_OPERATIONOptional LATENT_OPERATION. The operations will be applied in sequence.

Outputs (1)

NameTypeDescription
MODELMODEL