diff --git a/dynthres_comfyui.py b/dynthres_comfyui.py index 320d798..b07eb48 100644 --- a/dynthres_comfyui.py +++ b/dynthres_comfyui.py @@ -29,17 +29,17 @@ class DynamicThresholdingComfyNode: dynamic_thresh = DynThresh(mimic_scale, threshold_percentile, mimic_mode, mimic_scale_min, cfg_mode, cfg_scale_min, sched_val, 0, 999, separate_feature_channels == "enable", scaling_startpoint, variability_measure, interpolate_phi) - def sampler_dyn_thrash(args): - x_out = args["cond"] + def sampler_dyn_thresh(args): + cond = args["cond"] uncond = args["uncond"] cond_scale = args["cond_scale"] time_step = args["timestep"] dynamic_thresh.step = 999 - time_step[0] - return dynamic_thresh.dynthresh(x_out, uncond, cond_scale, None) + return dynamic_thresh.dynthresh(cond, uncond, cond_scale, None) m = model.clone() - m.set_model_sampler_cfg_function(sampler_dyn_thrash) + m.set_model_sampler_cfg_function(sampler_dyn_thresh) return (m, ) class DynamicThresholdingSimpleComfyNode: @@ -62,7 +62,7 @@ class DynamicThresholdingSimpleComfyNode: dynamic_thresh = DynThresh(mimic_scale, threshold_percentile, "CONSTANT", 0, "CONSTANT", 0, 0, 0, 999, False, "MEAN", "AD", 1) - def sampler_dyn_thrash(args): + def sampler_dyn_thresh(args): cond = args["cond"] uncond = args["uncond"] cond_scale = args["cond_scale"] @@ -72,5 +72,5 @@ class DynamicThresholdingSimpleComfyNode: return dynamic_thresh.dynthresh(cond, uncond, cond_scale, None) m = model.clone() - m.set_model_sampler_cfg_function(sampler_dyn_thrash) + m.set_model_sampler_cfg_function(sampler_dyn_thresh) return (m, ) diff --git a/scripts/dynamic_thresholding.py b/scripts/dynamic_thresholding.py index f3f98e4..303bbfc 100644 --- a/scripts/dynamic_thresholding.py +++ b/scripts/dynamic_thresholding.py @@ -212,7 +212,7 @@ class CustomCFGDenoiser(cfgdenoisekdiff): weights = torch.tensor(conds_list, device=uncond.device).select(2, 1) weights = weights.reshape(*weights.shape, 1, 1, 1) self.main_class.step = self.step - + if self.main_class.experiment_mode >= 4 and self.main_class.experiment_mode <= 5: # https://arxiv.org/pdf/2305.08891.pdf "Rescale CFG". It's not good, but if you want to test it, just set experiment_mode = 4 + phi. denoised = torch.clone(denoised_uncond)