DZRobo
commited on
Commit
·
0503191
1
Parent(s):
e42ce45
Add NAG fallback and fp32 decode options, update presets
Browse filesIntroduces NAG fallback logic to both easy and hard modules for improved guidance when CrossAttention patch is inactive. Adds an option to force VAE decode output to fp32 in the easy module. Updates mg_cade25.cfg with new default values for steps, cfg, denoise, buffer, guidance, and other parameters to improve quality and stability.
- mod/easy/mg_cade25_easy.py +42 -11
- mod/hard/mg_cade25.py +25 -2
- pressets/mg_cade25.cfg +43 -40
mod/easy/mg_cade25_easy.py
CHANGED
|
@@ -1070,7 +1070,7 @@ def _scheduler_names():
|
|
| 1070 |
return ["normal", "MGHybrid"]
|
| 1071 |
|
| 1072 |
|
| 1073 |
-
def safe_decode(vae, lat, tile=512, ovlp=
|
| 1074 |
# Ensure we don't build autograd graphs during final decode steps
|
| 1075 |
with torch.inference_mode():
|
| 1076 |
h, w = lat["samples"].shape[-2:]
|
|
@@ -1091,6 +1091,12 @@ def safe_decode(vae, lat, tile=512, ovlp=64):
|
|
| 1091 |
out_cpu = out_cpu.to('cpu')
|
| 1092 |
except Exception:
|
| 1093 |
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1094 |
try:
|
| 1095 |
del out
|
| 1096 |
except Exception:
|
|
@@ -1324,7 +1330,8 @@ def _wrap_model_with_guidance(model, guidance_mode: str, rescale_multiplier: flo
|
|
| 1324 |
cfg_sched_type: str = "off", cfg_sched_min: float = 0.0, cfg_sched_max: float = 0.0,
|
| 1325 |
cfg_sched_gamma: float = 1.5, cfg_sched_u_pow: float = 1.0,
|
| 1326 |
cwn_enable: bool = True, alpha_c: float = 1.0, alpha_u: float = 1.0,
|
| 1327 |
-
agc_enable: bool = True, agc_tau: float = 2.8
|
|
|
|
| 1328 |
|
| 1329 |
"""Clone model and attach a cfg mixing function implementing RescaleCFG/FDG, CFGZero*/FD, or hybrid ZeResFDG.
|
| 1330 |
guidance_mode: 'default' | 'RescaleCFG' | 'RescaleFDG' | 'CFGZero*' | 'CFGZeroFD' | 'ZeResFDG'
|
|
@@ -1361,6 +1368,25 @@ def _wrap_model_with_guidance(model, guidance_mode: str, rescale_multiplier: flo
|
|
| 1361 |
sigma = args.get("sigma", None)
|
| 1362 |
x_orig = args.get("input", None)
|
| 1363 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1364 |
# Local spatial gain from CURRENT_ONNX_MASK_BCHW, resized to cond spatial size
|
| 1365 |
def _local_gain_for(hw):
|
| 1366 |
if not bool(use_local_mask):
|
|
@@ -2242,6 +2268,9 @@ class ComfyAdaptiveDetailEnhancer25:
|
|
| 2242 |
cfg_sched_gamma = float(pv("cfg_sched_gamma", 1.5))
|
| 2243 |
cfg_sched_u_pow = float(pv("cfg_sched_u_pow", 1.0))
|
| 2244 |
|
|
|
|
|
|
|
|
|
|
| 2245 |
# CWN + AGC defaults (hidden in Easy; controlled via presets)
|
| 2246 |
cwn_enable = bool(pv("cwn_enable", True))
|
| 2247 |
alpha_c = float(pv("alpha_c", 1.0))
|
|
@@ -2277,7 +2306,7 @@ class ComfyAdaptiveDetailEnhancer25:
|
|
| 2277 |
except Exception:
|
| 2278 |
pass
|
| 2279 |
|
| 2280 |
-
image = safe_decode(vae, latent)
|
| 2281 |
# allow user cancel right after initial decode
|
| 2282 |
model_management.throw_exception_if_processing_interrupted()
|
| 2283 |
|
|
@@ -2502,7 +2531,8 @@ class ComfyAdaptiveDetailEnhancer25:
|
|
| 2502 |
cfg_sched_type=str(cfg_sched), cfg_sched_min=float(cfg_sched_min), cfg_sched_max=float(cfg_sched_max),
|
| 2503 |
cfg_sched_gamma=float(cfg_sched_gamma), cfg_sched_u_pow=float(cfg_sched_u_pow),
|
| 2504 |
cwn_enable=bool(cwn_enable), alpha_c=float(alpha_c), alpha_u=float(alpha_u),
|
| 2505 |
-
agc_enable=bool(agc_enable), agc_tau=float(agc_tau)
|
|
|
|
| 2506 |
)
|
| 2507 |
# check once more right before the loop starts
|
| 2508 |
model_management.throw_exception_if_processing_interrupted()
|
|
@@ -2549,7 +2579,7 @@ class ComfyAdaptiveDetailEnhancer25:
|
|
| 2549 |
try:
|
| 2550 |
import os
|
| 2551 |
models_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "models")
|
| 2552 |
-
img_preview = safe_decode(vae, current_latent)
|
| 2553 |
# Set toggles for this iteration
|
| 2554 |
globals()["_ONNX_DEBUG"] = bool(onnx_debug)
|
| 2555 |
globals()["_ONNX_COUNT_DEBUG"] = True # force counts ON for debugging session
|
|
@@ -2583,7 +2613,7 @@ class ComfyAdaptiveDetailEnhancer25:
|
|
| 2583 |
# CF edge mask (from current image) and fusion (only when enabled)
|
| 2584 |
if bool(seg_use_cf_edges):
|
| 2585 |
try:
|
| 2586 |
-
img_prev2 = safe_decode(vae, current_latent)
|
| 2587 |
em2 = _build_cf_edge_mask_from_step(img_prev2, str(preset_step))
|
| 2588 |
if em2 is not None:
|
| 2589 |
if onnx_mask_last is None:
|
|
@@ -2680,7 +2710,7 @@ class ComfyAdaptiveDetailEnhancer25:
|
|
| 2680 |
try:
|
| 2681 |
do_local_refine = False # disable local best-of-2 by default
|
| 2682 |
if do_local_refine:
|
| 2683 |
-
img_roi = safe_decode(vae, current_latent)
|
| 2684 |
roi = _clipseg_build_mask(img_roi, "hand | hands | face", preview=max(192, int(clipseg_preview//2)), threshold=0.40, blur=5.0, dilate=2, gain=1.0)
|
| 2685 |
if roi is None and onnx_mask_last is not None:
|
| 2686 |
roi = torch.clamp(onnx_mask_last, 0.0, 1.0)
|
|
@@ -2710,13 +2740,13 @@ class ComfyAdaptiveDetailEnhancer25:
|
|
| 2710 |
lat_a, = nodes.common_ksampler(
|
| 2711 |
sampler_model, s1, micro_steps, current_cfg, sampler_name, scheduler,
|
| 2712 |
positive, negative, lat_in_a, denoise=micro_denoise)
|
| 2713 |
-
img_a = safe_decode(vae, lat_a)
|
| 2714 |
# Candidate B
|
| 2715 |
lat_in_b = {"samples": current_latent["samples"].clone()}
|
| 2716 |
lat_b, = nodes.common_ksampler(
|
| 2717 |
sampler_model, s2, micro_steps, current_cfg, sampler_name, scheduler,
|
| 2718 |
positive, negative, lat_in_b, denoise=micro_denoise)
|
| 2719 |
-
img_b = safe_decode(vae, lat_b)
|
| 2720 |
|
| 2721 |
# Score inside ROI
|
| 2722 |
def _roi_stats(img, roi_mask):
|
|
@@ -2962,7 +2992,7 @@ class ComfyAdaptiveDetailEnhancer25:
|
|
| 2962 |
except Exception:
|
| 2963 |
pass
|
| 2964 |
|
| 2965 |
-
image = safe_decode(vae, current_latent)
|
| 2966 |
# and again after decode before post-processing
|
| 2967 |
model_management.throw_exception_if_processing_interrupted()
|
| 2968 |
|
|
@@ -3459,7 +3489,7 @@ def _smart_seed_select(model,
|
|
| 3459 |
model, int(sd), int(probe_steps), float(cfg), str(sampler_name), str(scheduler),
|
| 3460 |
positive, negative, lat_in, denoise=float(min(denoise, 0.65))
|
| 3461 |
)
|
| 3462 |
-
img = safe_decode(vae, lat_out)
|
| 3463 |
# and again right after decode
|
| 3464 |
model_management.throw_exception_if_processing_interrupted()
|
| 3465 |
# Base score: edge density toward a target + low speckle + balanced exposure
|
|
@@ -3598,3 +3628,4 @@ def _interruptible_ksampler(model, seed, steps, cfg, sampler_name, scheduler,
|
|
| 3598 |
out = {**latent}
|
| 3599 |
out["samples"] = samples
|
| 3600 |
return (out,)
|
|
|
|
|
|
| 1070 |
return ["normal", "MGHybrid"]
|
| 1071 |
|
| 1072 |
|
| 1073 |
+
def safe_decode(vae, lat, tile=512, ovlp=128, to_fp32: bool = False):
|
| 1074 |
# Ensure we don't build autograd graphs during final decode steps
|
| 1075 |
with torch.inference_mode():
|
| 1076 |
h, w = lat["samples"].shape[-2:]
|
|
|
|
| 1091 |
out_cpu = out_cpu.to('cpu')
|
| 1092 |
except Exception:
|
| 1093 |
pass
|
| 1094 |
+
# Optional: force fp32 decode output (after moving to CPU to save VRAM)
|
| 1095 |
+
try:
|
| 1096 |
+
if bool(to_fp32) and out_cpu.dtype != torch.float32:
|
| 1097 |
+
out_cpu = out_cpu.float()
|
| 1098 |
+
except Exception:
|
| 1099 |
+
pass
|
| 1100 |
try:
|
| 1101 |
del out
|
| 1102 |
except Exception:
|
|
|
|
| 1330 |
cfg_sched_type: str = "off", cfg_sched_min: float = 0.0, cfg_sched_max: float = 0.0,
|
| 1331 |
cfg_sched_gamma: float = 1.5, cfg_sched_u_pow: float = 1.0,
|
| 1332 |
cwn_enable: bool = True, alpha_c: float = 1.0, alpha_u: float = 1.0,
|
| 1333 |
+
agc_enable: bool = True, agc_tau: float = 2.8,
|
| 1334 |
+
nag_fb_enable: bool = False, nag_fb_scale: float = 4.0, nag_fb_tau: float = 2.5, nag_fb_alpha: float = 0.25):
|
| 1335 |
|
| 1336 |
"""Clone model and attach a cfg mixing function implementing RescaleCFG/FDG, CFGZero*/FD, or hybrid ZeResFDG.
|
| 1337 |
guidance_mode: 'default' | 'RescaleCFG' | 'RescaleFDG' | 'CFGZero*' | 'CFGZeroFD' | 'ZeResFDG'
|
|
|
|
| 1368 |
sigma = args.get("sigma", None)
|
| 1369 |
x_orig = args.get("input", None)
|
| 1370 |
|
| 1371 |
+
# --- NAG fallback in noise-space (when CrossAttention patch is inactive) ---
|
| 1372 |
+
if bool(nag_fb_enable):
|
| 1373 |
+
try:
|
| 1374 |
+
active = bool(getattr(sa_patch, "_nag_patch_active", False))
|
| 1375 |
+
except Exception:
|
| 1376 |
+
active = False
|
| 1377 |
+
if not active:
|
| 1378 |
+
try:
|
| 1379 |
+
phi = float(nag_fb_scale); tau = float(nag_fb_tau); a = float(nag_fb_alpha)
|
| 1380 |
+
g = cond * phi - uncond * (phi - 1.0)
|
| 1381 |
+
def _l1(x):
|
| 1382 |
+
return torch.sum(torch.abs(x), dim=(1,2,3), keepdim=True).clamp_min(1e-6)
|
| 1383 |
+
s_pos = _l1(cond); s_g = _l1(g)
|
| 1384 |
+
scale = (s_pos * tau) / s_g
|
| 1385 |
+
g = torch.where((s_g > s_pos * tau), g * scale, g)
|
| 1386 |
+
cond = g * a + cond * (1.0 - a)
|
| 1387 |
+
except Exception:
|
| 1388 |
+
pass
|
| 1389 |
+
|
| 1390 |
# Local spatial gain from CURRENT_ONNX_MASK_BCHW, resized to cond spatial size
|
| 1391 |
def _local_gain_for(hw):
|
| 1392 |
if not bool(use_local_mask):
|
|
|
|
| 2268 |
cfg_sched_gamma = float(pv("cfg_sched_gamma", 1.5))
|
| 2269 |
cfg_sched_u_pow = float(pv("cfg_sched_u_pow", 1.0))
|
| 2270 |
|
| 2271 |
+
# VAE decode: allow forcing fp32 output (default false)
|
| 2272 |
+
vae_decode_fp32 = bool(pv("vae_decode_fp32", False))
|
| 2273 |
+
|
| 2274 |
# CWN + AGC defaults (hidden in Easy; controlled via presets)
|
| 2275 |
cwn_enable = bool(pv("cwn_enable", True))
|
| 2276 |
alpha_c = float(pv("alpha_c", 1.0))
|
|
|
|
| 2306 |
except Exception:
|
| 2307 |
pass
|
| 2308 |
|
| 2309 |
+
image = safe_decode(vae, latent, to_fp32=bool(vae_decode_fp32))
|
| 2310 |
# allow user cancel right after initial decode
|
| 2311 |
model_management.throw_exception_if_processing_interrupted()
|
| 2312 |
|
|
|
|
| 2531 |
cfg_sched_type=str(cfg_sched), cfg_sched_min=float(cfg_sched_min), cfg_sched_max=float(cfg_sched_max),
|
| 2532 |
cfg_sched_gamma=float(cfg_sched_gamma), cfg_sched_u_pow=float(cfg_sched_u_pow),
|
| 2533 |
cwn_enable=bool(cwn_enable), alpha_c=float(alpha_c), alpha_u=float(alpha_u),
|
| 2534 |
+
agc_enable=bool(agc_enable), agc_tau=float(agc_tau),
|
| 2535 |
+
nag_fb_enable=bool(use_nag), nag_fb_scale=float(nag_scale), nag_fb_tau=float(nag_tau), nag_fb_alpha=float(nag_alpha)
|
| 2536 |
)
|
| 2537 |
# check once more right before the loop starts
|
| 2538 |
model_management.throw_exception_if_processing_interrupted()
|
|
|
|
| 2579 |
try:
|
| 2580 |
import os
|
| 2581 |
models_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "models")
|
| 2582 |
+
img_preview = safe_decode(vae, current_latent, to_fp32=bool(vae_decode_fp32))
|
| 2583 |
# Set toggles for this iteration
|
| 2584 |
globals()["_ONNX_DEBUG"] = bool(onnx_debug)
|
| 2585 |
globals()["_ONNX_COUNT_DEBUG"] = True # force counts ON for debugging session
|
|
|
|
| 2613 |
# CF edge mask (from current image) and fusion (only when enabled)
|
| 2614 |
if bool(seg_use_cf_edges):
|
| 2615 |
try:
|
| 2616 |
+
img_prev2 = safe_decode(vae, current_latent, to_fp32=bool(vae_decode_fp32))
|
| 2617 |
em2 = _build_cf_edge_mask_from_step(img_prev2, str(preset_step))
|
| 2618 |
if em2 is not None:
|
| 2619 |
if onnx_mask_last is None:
|
|
|
|
| 2710 |
try:
|
| 2711 |
do_local_refine = False # disable local best-of-2 by default
|
| 2712 |
if do_local_refine:
|
| 2713 |
+
img_roi = safe_decode(vae, current_latent, to_fp32=bool(vae_decode_fp32))
|
| 2714 |
roi = _clipseg_build_mask(img_roi, "hand | hands | face", preview=max(192, int(clipseg_preview//2)), threshold=0.40, blur=5.0, dilate=2, gain=1.0)
|
| 2715 |
if roi is None and onnx_mask_last is not None:
|
| 2716 |
roi = torch.clamp(onnx_mask_last, 0.0, 1.0)
|
|
|
|
| 2740 |
lat_a, = nodes.common_ksampler(
|
| 2741 |
sampler_model, s1, micro_steps, current_cfg, sampler_name, scheduler,
|
| 2742 |
positive, negative, lat_in_a, denoise=micro_denoise)
|
| 2743 |
+
img_a = safe_decode(vae, lat_a, to_fp32=bool(vae_decode_fp32))
|
| 2744 |
# Candidate B
|
| 2745 |
lat_in_b = {"samples": current_latent["samples"].clone()}
|
| 2746 |
lat_b, = nodes.common_ksampler(
|
| 2747 |
sampler_model, s2, micro_steps, current_cfg, sampler_name, scheduler,
|
| 2748 |
positive, negative, lat_in_b, denoise=micro_denoise)
|
| 2749 |
+
img_b = safe_decode(vae, lat_b, to_fp32=bool(vae_decode_fp32))
|
| 2750 |
|
| 2751 |
# Score inside ROI
|
| 2752 |
def _roi_stats(img, roi_mask):
|
|
|
|
| 2992 |
except Exception:
|
| 2993 |
pass
|
| 2994 |
|
| 2995 |
+
image = safe_decode(vae, current_latent, to_fp32=bool(vae_decode_fp32))
|
| 2996 |
# and again after decode before post-processing
|
| 2997 |
model_management.throw_exception_if_processing_interrupted()
|
| 2998 |
|
|
|
|
| 3489 |
model, int(sd), int(probe_steps), float(cfg), str(sampler_name), str(scheduler),
|
| 3490 |
positive, negative, lat_in, denoise=float(min(denoise, 0.65))
|
| 3491 |
)
|
| 3492 |
+
img = safe_decode(vae, lat_out, to_fp32=bool(vae_decode_fp32))
|
| 3493 |
# and again right after decode
|
| 3494 |
model_management.throw_exception_if_processing_interrupted()
|
| 3495 |
# Base score: edge density toward a target + low speckle + balanced exposure
|
|
|
|
| 3628 |
out = {**latent}
|
| 3629 |
out["samples"] = samples
|
| 3630 |
return (out,)
|
| 3631 |
+
|
mod/hard/mg_cade25.py
CHANGED
|
@@ -971,7 +971,9 @@ def _wrap_model_with_guidance(model, guidance_mode: str, rescale_multiplier: flo
|
|
| 971 |
eps_scale_enable: bool = False, eps_scale: float = 0.0,
|
| 972 |
# NEW: CWN + AGC for Hard node too
|
| 973 |
cwn_enable: bool = True, alpha_c: float = 1.0, alpha_u: float = 1.0,
|
| 974 |
-
agc_enable: bool = True, agc_tau: float = 2.8
|
|
|
|
|
|
|
| 975 |
|
| 976 |
"""Clone model and attach a cfg mixing function implementing RescaleCFG/FDG, CFGZero*/FD, or hybrid ZeResFDG.
|
| 977 |
guidance_mode: 'default' | 'RescaleCFG' | 'RescaleFDG' | 'CFGZero*' | 'CFGZeroFD' | 'ZeResFDG'
|
|
@@ -1008,6 +1010,26 @@ def _wrap_model_with_guidance(model, guidance_mode: str, rescale_multiplier: flo
|
|
| 1008 |
sigma = args.get("sigma", None)
|
| 1009 |
x_orig = args.get("input", None)
|
| 1010 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1011 |
# Local spatial gain from CURRENT_ONNX_MASK_BCHW, resized to cond spatial size
|
| 1012 |
def _local_gain_for(hw):
|
| 1013 |
if not bool(use_local_mask):
|
|
@@ -1762,7 +1784,8 @@ class ComfyAdaptiveDetailEnhancer25:
|
|
| 1762 |
mahiro_plus_enable=bool(muse_blend), mahiro_plus_strength=float(muse_blend_strength),
|
| 1763 |
eps_scale_enable=bool(eps_scale_enable), eps_scale=float(eps_scale),
|
| 1764 |
cwn_enable=bool(cwn_enable), alpha_c=float(alpha_c), alpha_u=float(alpha_u),
|
| 1765 |
-
agc_enable=bool(agc_enable), agc_tau=float(agc_tau)
|
|
|
|
| 1766 |
)
|
| 1767 |
# early interruption check before starting the loop
|
| 1768 |
try:
|
|
|
|
| 971 |
eps_scale_enable: bool = False, eps_scale: float = 0.0,
|
| 972 |
# NEW: CWN + AGC for Hard node too
|
| 973 |
cwn_enable: bool = True, alpha_c: float = 1.0, alpha_u: float = 1.0,
|
| 974 |
+
agc_enable: bool = True, agc_tau: float = 2.8,
|
| 975 |
+
# NAG fallback
|
| 976 |
+
nag_fb_enable: bool = False, nag_fb_scale: float = 4.0, nag_fb_tau: float = 2.5, nag_fb_alpha: float = 0.25):
|
| 977 |
|
| 978 |
"""Clone model and attach a cfg mixing function implementing RescaleCFG/FDG, CFGZero*/FD, or hybrid ZeResFDG.
|
| 979 |
guidance_mode: 'default' | 'RescaleCFG' | 'RescaleFDG' | 'CFGZero*' | 'CFGZeroFD' | 'ZeResFDG'
|
|
|
|
| 1010 |
sigma = args.get("sigma", None)
|
| 1011 |
x_orig = args.get("input", None)
|
| 1012 |
|
| 1013 |
+
# NAG fallback (noise-space) when CrossAttention patch inactive
|
| 1014 |
+
if bool(nag_fb_enable):
|
| 1015 |
+
try:
|
| 1016 |
+
from . import mg_sagpu_attention as _sa
|
| 1017 |
+
active = bool(getattr(_sa, "_nag_patch_active", False))
|
| 1018 |
+
except Exception:
|
| 1019 |
+
active = False
|
| 1020 |
+
if not active:
|
| 1021 |
+
try:
|
| 1022 |
+
phi = float(nag_fb_scale); tau = float(nag_fb_tau); a = float(nag_fb_alpha)
|
| 1023 |
+
g = cond * phi - uncond * (phi - 1.0)
|
| 1024 |
+
def _l1(x):
|
| 1025 |
+
return torch.sum(torch.abs(x), dim=(1,2,3), keepdim=True).clamp_min(1e-6)
|
| 1026 |
+
s_pos = _l1(cond); s_g = _l1(g)
|
| 1027 |
+
scale = (s_pos * tau) / s_g
|
| 1028 |
+
g = torch.where((s_g > s_pos * tau), g * scale, g)
|
| 1029 |
+
cond = g * a + cond * (1.0 - a)
|
| 1030 |
+
except Exception:
|
| 1031 |
+
pass
|
| 1032 |
+
|
| 1033 |
# Local spatial gain from CURRENT_ONNX_MASK_BCHW, resized to cond spatial size
|
| 1034 |
def _local_gain_for(hw):
|
| 1035 |
if not bool(use_local_mask):
|
|
|
|
| 1784 |
mahiro_plus_enable=bool(muse_blend), mahiro_plus_strength=float(muse_blend_strength),
|
| 1785 |
eps_scale_enable=bool(eps_scale_enable), eps_scale=float(eps_scale),
|
| 1786 |
cwn_enable=bool(cwn_enable), alpha_c=float(alpha_c), alpha_u=float(alpha_u),
|
| 1787 |
+
agc_enable=bool(agc_enable), agc_tau=float(agc_tau),
|
| 1788 |
+
nag_fb_enable=bool(use_nag), nag_fb_scale=float(nag_scale), nag_fb_tau=float(nag_tau), nag_fb_alpha=float(nag_alpha)
|
| 1789 |
)
|
| 1790 |
# early interruption check before starting the loop
|
| 1791 |
try:
|
pressets/mg_cade25.cfg
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
[step1]
|
| 4 |
# core
|
|
@@ -280,14 +281,15 @@ aq_alpha: 2.0
|
|
| 280 |
|
| 281 |
aq_attn: true
|
| 282 |
|
|
|
|
| 283 |
|
| 284 |
[step3]
|
| 285 |
# core
|
| 286 |
seed: 0
|
| 287 |
control_after_generate: randomize
|
| 288 |
-
steps:
|
| 289 |
-
cfg:
|
| 290 |
-
denoise: 0.
|
| 291 |
sampler_name: ddim
|
| 292 |
scheduler: MGHybrid
|
| 293 |
iterations: 2
|
|
@@ -307,13 +309,13 @@ latent_compare: true
|
|
| 307 |
|
| 308 |
# latent buffer (internal)
|
| 309 |
latent_buffer: true
|
| 310 |
-
lb_inject: 0.
|
| 311 |
lb_ema: 0.75
|
| 312 |
lb_every: 1
|
| 313 |
lb_anchor_every: 4
|
| 314 |
lb_masked: true
|
| 315 |
-
lb_rebase_thresh: 0.
|
| 316 |
-
lb_rebase_rate: 0.
|
| 317 |
|
| 318 |
# detail controls
|
| 319 |
#ids_strength: 0.25
|
|
@@ -321,7 +323,7 @@ ids_strength: 0.55
|
|
| 321 |
upscale_method: lanczos
|
| 322 |
scale_by: 1.20
|
| 323 |
scale_delta: 0.10
|
| 324 |
-
noise_offset: 0.
|
| 325 |
threshold: 1.000
|
| 326 |
#0.135
|
| 327 |
Sharpnes_strenght: 0.185
|
|
@@ -330,35 +332,35 @@ accumulation: fp32+fp32
|
|
| 330 |
# reference clean
|
| 331 |
reference_clean: true
|
| 332 |
ref_preview: 512
|
| 333 |
-
ref_threshold: 0.
|
| 334 |
ref_cooldown: 2
|
| 335 |
|
| 336 |
# cfg schedule (internal)
|
| 337 |
#cfg_sched: off | cosine | warmup | u
|
| 338 |
cfg_sched: warmup
|
| 339 |
-
cfg_sched_min: 5.
|
| 340 |
-
cfg_sched_max:
|
| 341 |
cfg_sched_gamma: 1.5
|
| 342 |
cfg_sched_u_pow: 1.2
|
| 343 |
|
| 344 |
|
| 345 |
# guidance
|
| 346 |
guidance_mode: ZeResFDG
|
| 347 |
-
rescale_multiplier: 0.
|
| 348 |
-
momentum_beta: 0.
|
| 349 |
-
cfg_curve:
|
| 350 |
-
perp_damp: 0.
|
| 351 |
|
| 352 |
# CWN/AGC
|
| 353 |
cwn_enable: true
|
| 354 |
-
alpha_c: 1.
|
| 355 |
-
alpha_u:
|
| 356 |
agc_enable: true
|
| 357 |
-
agc_tau: 2
|
| 358 |
|
| 359 |
# NAG
|
| 360 |
use_nag: true
|
| 361 |
-
nag_scale:
|
| 362 |
nag_tau: 2.50
|
| 363 |
nag_alpha: 0.25
|
| 364 |
|
|
@@ -367,16 +369,16 @@ use_zero_init: false
|
|
| 367 |
zero_init_steps: 0
|
| 368 |
|
| 369 |
# FDG / ZE thresholds
|
| 370 |
-
fdg_low: 0.
|
| 371 |
-
fdg_high: 1.
|
| 372 |
-
fdg_sigma: 1.
|
| 373 |
ze_res_zero_steps: 6
|
| 374 |
ze_adaptive: true
|
| 375 |
-
ze_r_switch_hi: 0.
|
| 376 |
ze_r_switch_lo: 0.25
|
| 377 |
fdg_low_adaptive: true
|
| 378 |
-
fdg_low_min: 0.
|
| 379 |
-
fdg_low_max:
|
| 380 |
fdg_ema_beta: 0.45
|
| 381 |
|
| 382 |
|
|
@@ -386,7 +388,7 @@ muse_blend_strength: 0.24
|
|
| 386 |
|
| 387 |
# eps scale
|
| 388 |
eps_scale_enable: true
|
| 389 |
-
eps_scale: 0.
|
| 390 |
|
| 391 |
# CLIPSeg
|
| 392 |
clipseg_enable: true
|
|
@@ -401,7 +403,7 @@ clipseg_ref_gate: true
|
|
| 401 |
clipseg_ref_threshold: 0.005
|
| 402 |
|
| 403 |
# polish
|
| 404 |
-
polish_enable:
|
| 405 |
polish_keep_low: 0.40
|
| 406 |
polish_edge_lock: 0.20
|
| 407 |
polish_sigma: 1.0
|
|
@@ -411,8 +413,8 @@ polish_keep_low_ramp: 0.20
|
|
| 411 |
# mid-frequency stabilizer (hands/objects scale)
|
| 412 |
midfreq_enable: true
|
| 413 |
#midfreq_gain: 0.15
|
| 414 |
-
midfreq_gain: 0.
|
| 415 |
-
midfreq_sigma_lo: 0.
|
| 416 |
midfreq_sigma_hi: 2.10
|
| 417 |
|
| 418 |
# QSilk-AQClip-Lite (adaptive latent clipping)
|
|
@@ -423,14 +425,16 @@ aq_alpha: 2.0
|
|
| 423 |
|
| 424 |
aq_attn: true
|
| 425 |
|
|
|
|
|
|
|
| 426 |
[step4]
|
| 427 |
# core
|
| 428 |
seed: 0
|
| 429 |
control_after_generate: randomize
|
| 430 |
-
steps:
|
| 431 |
cfg: 6
|
| 432 |
#0.75
|
| 433 |
-
denoise: 0.
|
| 434 |
sampler_name: ddim
|
| 435 |
scheduler: MGHybrid
|
| 436 |
iterations: 2
|
|
@@ -453,7 +457,7 @@ latent_buffer: true
|
|
| 453 |
lb_inject: 0.30
|
| 454 |
lb_ema: 0.75
|
| 455 |
lb_every: 1
|
| 456 |
-
lb_anchor_every:
|
| 457 |
lb_masked: true
|
| 458 |
lb_rebase_thresh: 0.10
|
| 459 |
lb_rebase_rate: 0.25
|
|
@@ -464,7 +468,7 @@ upscale_method: lanczos
|
|
| 464 |
# 1.55
|
| 465 |
scale_by: 1.50
|
| 466 |
scale_delta: 0.1
|
| 467 |
-
noise_offset: 0.
|
| 468 |
threshold: 1.000
|
| 469 |
Sharpnes_strenght: 0.24
|
| 470 |
accumulation: fp32+fp32
|
|
@@ -478,7 +482,7 @@ ref_cooldown: 2
|
|
| 478 |
# cfg schedule (internal)
|
| 479 |
#cfg_sched: off | cosine | warmup | u
|
| 480 |
cfg_sched: cosine
|
| 481 |
-
cfg_sched_min:
|
| 482 |
cfg_sched_max: 8.0
|
| 483 |
cfg_sched_gamma: 1.5
|
| 484 |
cfg_sched_u_pow: 1.2
|
|
@@ -493,10 +497,10 @@ perp_damp: 0.85
|
|
| 493 |
|
| 494 |
# CWN/AGC
|
| 495 |
cwn_enable: true
|
| 496 |
-
alpha_c: 1.
|
| 497 |
alpha_u: 1.0
|
| 498 |
agc_enable: true
|
| 499 |
-
agc_tau:
|
| 500 |
|
| 501 |
# NAG
|
| 502 |
use_nag: true
|
|
@@ -510,7 +514,7 @@ zero_init_steps: 0
|
|
| 510 |
|
| 511 |
# FDG / ZE thresholds
|
| 512 |
fdg_low: 0.35
|
| 513 |
-
fdg_high:
|
| 514 |
fdg_sigma: 1.20
|
| 515 |
ze_res_zero_steps: 10
|
| 516 |
ze_adaptive: true
|
|
@@ -544,7 +548,7 @@ clipseg_ref_threshold: 0.005
|
|
| 544 |
seg_use_cf_edges: true
|
| 545 |
|
| 546 |
# polish
|
| 547 |
-
polish_enable:
|
| 548 |
polish_keep_low: 0.45
|
| 549 |
polish_edge_lock: 0.12
|
| 550 |
polish_sigma: 0.8
|
|
@@ -572,5 +576,4 @@ aq_attn: true
|
|
| 572 |
# KV pruning (self-attention speedup)
|
| 573 |
kv_prune_enable: false
|
| 574 |
kv_keep: 0.95
|
| 575 |
-
kv_min_tokens: 256
|
| 576 |
-
|
|
|
|
| 1 |
+
|
| 2 |
+
# MagicNodes CADE 2.5 presets
|
| 3 |
|
| 4 |
[step1]
|
| 5 |
# core
|
|
|
|
| 281 |
|
| 282 |
aq_attn: true
|
| 283 |
|
| 284 |
+
vae_decode_fp32: true
|
| 285 |
|
| 286 |
[step3]
|
| 287 |
# core
|
| 288 |
seed: 0
|
| 289 |
control_after_generate: randomize
|
| 290 |
+
steps: 20
|
| 291 |
+
cfg: 6.0
|
| 292 |
+
denoise: 0.46
|
| 293 |
sampler_name: ddim
|
| 294 |
scheduler: MGHybrid
|
| 295 |
iterations: 2
|
|
|
|
| 309 |
|
| 310 |
# latent buffer (internal)
|
| 311 |
latent_buffer: true
|
| 312 |
+
lb_inject: 0.10
|
| 313 |
lb_ema: 0.75
|
| 314 |
lb_every: 1
|
| 315 |
lb_anchor_every: 4
|
| 316 |
lb_masked: true
|
| 317 |
+
lb_rebase_thresh: 0.18
|
| 318 |
+
lb_rebase_rate: 0.10
|
| 319 |
|
| 320 |
# detail controls
|
| 321 |
#ids_strength: 0.25
|
|
|
|
| 323 |
upscale_method: lanczos
|
| 324 |
scale_by: 1.20
|
| 325 |
scale_delta: 0.10
|
| 326 |
+
noise_offset: 0.03
|
| 327 |
threshold: 1.000
|
| 328 |
#0.135
|
| 329 |
Sharpnes_strenght: 0.185
|
|
|
|
| 332 |
# reference clean
|
| 333 |
reference_clean: true
|
| 334 |
ref_preview: 512
|
| 335 |
+
ref_threshold: 0.320
|
| 336 |
ref_cooldown: 2
|
| 337 |
|
| 338 |
# cfg schedule (internal)
|
| 339 |
#cfg_sched: off | cosine | warmup | u
|
| 340 |
cfg_sched: warmup
|
| 341 |
+
cfg_sched_min: 5.0
|
| 342 |
+
cfg_sched_max: 6.5
|
| 343 |
cfg_sched_gamma: 1.5
|
| 344 |
cfg_sched_u_pow: 1.2
|
| 345 |
|
| 346 |
|
| 347 |
# guidance
|
| 348 |
guidance_mode: ZeResFDG
|
| 349 |
+
rescale_multiplier: 0.95
|
| 350 |
+
momentum_beta: 0.65
|
| 351 |
+
cfg_curve: 1.15
|
| 352 |
+
perp_damp: 0.90
|
| 353 |
|
| 354 |
# CWN/AGC
|
| 355 |
cwn_enable: true
|
| 356 |
+
alpha_c: 1.09
|
| 357 |
+
alpha_u: 0.8
|
| 358 |
agc_enable: true
|
| 359 |
+
agc_tau: 1.2
|
| 360 |
|
| 361 |
# NAG
|
| 362 |
use_nag: true
|
| 363 |
+
nag_scale: 3.6
|
| 364 |
nag_tau: 2.50
|
| 365 |
nag_alpha: 0.25
|
| 366 |
|
|
|
|
| 369 |
zero_init_steps: 0
|
| 370 |
|
| 371 |
# FDG / ZE thresholds
|
| 372 |
+
fdg_low: 0.45
|
| 373 |
+
fdg_high: 1.45
|
| 374 |
+
fdg_sigma: 1.80
|
| 375 |
ze_res_zero_steps: 6
|
| 376 |
ze_adaptive: true
|
| 377 |
+
ze_r_switch_hi: 0.55
|
| 378 |
ze_r_switch_lo: 0.25
|
| 379 |
fdg_low_adaptive: true
|
| 380 |
+
fdg_low_min: 0.15
|
| 381 |
+
fdg_low_max: 1.85
|
| 382 |
fdg_ema_beta: 0.45
|
| 383 |
|
| 384 |
|
|
|
|
| 388 |
|
| 389 |
# eps scale
|
| 390 |
eps_scale_enable: true
|
| 391 |
+
eps_scale: 0.0225
|
| 392 |
|
| 393 |
# CLIPSeg
|
| 394 |
clipseg_enable: true
|
|
|
|
| 403 |
clipseg_ref_threshold: 0.005
|
| 404 |
|
| 405 |
# polish
|
| 406 |
+
polish_enable: true
|
| 407 |
polish_keep_low: 0.40
|
| 408 |
polish_edge_lock: 0.20
|
| 409 |
polish_sigma: 1.0
|
|
|
|
| 413 |
# mid-frequency stabilizer (hands/objects scale)
|
| 414 |
midfreq_enable: true
|
| 415 |
#midfreq_gain: 0.15
|
| 416 |
+
midfreq_gain: 0.45
|
| 417 |
+
midfreq_sigma_lo: 0.80
|
| 418 |
midfreq_sigma_hi: 2.10
|
| 419 |
|
| 420 |
# QSilk-AQClip-Lite (adaptive latent clipping)
|
|
|
|
| 425 |
|
| 426 |
aq_attn: true
|
| 427 |
|
| 428 |
+
vae_decode_fp32: true
|
| 429 |
+
|
| 430 |
[step4]
|
| 431 |
# core
|
| 432 |
seed: 0
|
| 433 |
control_after_generate: randomize
|
| 434 |
+
steps: 20
|
| 435 |
cfg: 6
|
| 436 |
#0.75
|
| 437 |
+
denoise: 0.46
|
| 438 |
sampler_name: ddim
|
| 439 |
scheduler: MGHybrid
|
| 440 |
iterations: 2
|
|
|
|
| 457 |
lb_inject: 0.30
|
| 458 |
lb_ema: 0.75
|
| 459 |
lb_every: 1
|
| 460 |
+
lb_anchor_every: 3
|
| 461 |
lb_masked: true
|
| 462 |
lb_rebase_thresh: 0.10
|
| 463 |
lb_rebase_rate: 0.25
|
|
|
|
| 468 |
# 1.55
|
| 469 |
scale_by: 1.50
|
| 470 |
scale_delta: 0.1
|
| 471 |
+
noise_offset: 0.0135
|
| 472 |
threshold: 1.000
|
| 473 |
Sharpnes_strenght: 0.24
|
| 474 |
accumulation: fp32+fp32
|
|
|
|
| 482 |
# cfg schedule (internal)
|
| 483 |
#cfg_sched: off | cosine | warmup | u
|
| 484 |
cfg_sched: cosine
|
| 485 |
+
cfg_sched_min: 4.9
|
| 486 |
cfg_sched_max: 8.0
|
| 487 |
cfg_sched_gamma: 1.5
|
| 488 |
cfg_sched_u_pow: 1.2
|
|
|
|
| 497 |
|
| 498 |
# CWN/AGC
|
| 499 |
cwn_enable: true
|
| 500 |
+
alpha_c: 1.03
|
| 501 |
alpha_u: 1.0
|
| 502 |
agc_enable: true
|
| 503 |
+
agc_tau: 3.2
|
| 504 |
|
| 505 |
# NAG
|
| 506 |
use_nag: true
|
|
|
|
| 514 |
|
| 515 |
# FDG / ZE thresholds
|
| 516 |
fdg_low: 0.35
|
| 517 |
+
fdg_high: 1.10
|
| 518 |
fdg_sigma: 1.20
|
| 519 |
ze_res_zero_steps: 10
|
| 520 |
ze_adaptive: true
|
|
|
|
| 548 |
seg_use_cf_edges: true
|
| 549 |
|
| 550 |
# polish
|
| 551 |
+
polish_enable: true
|
| 552 |
polish_keep_low: 0.45
|
| 553 |
polish_edge_lock: 0.12
|
| 554 |
polish_sigma: 0.8
|
|
|
|
| 576 |
# KV pruning (self-attention speedup)
|
| 577 |
kv_prune_enable: false
|
| 578 |
kv_keep: 0.95
|
| 579 |
+
kv_min_tokens: 256
|
|
|