From 9f7a117ed44c07f23ac077c888253697f70eafd8 Mon Sep 17 00:00:00 2001 From: nullquant Date: Fri, 17 May 2024 01:36:36 +0300 Subject: [PATCH] do_classifier_guidance from cond_or_uncond --- brushnet_nodes.py | 6 +++--- model_patch.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/brushnet_nodes.py b/brushnet_nodes.py index b07f960..6e2ec5a 100644 --- a/brushnet_nodes.py +++ b/brushnet_nodes.py @@ -773,8 +773,8 @@ def brushnet_inference(x, timesteps, transformer_options): npe = bo['negative_prompt_embeds'] ppe, nppe, time_ids = bo['add_embeds'] - do_classifier_free_guidance = mp['free_guidance'] - #do_classifier_free_guidance = len(transformer_options['cond_or_uncond']) > 1 + #do_classifier_free_guidance = mp['free_guidance'] + do_classifier_free_guidance = len(transformer_options['cond_or_uncond']) > 1 x = x.detach().clone() x = x.to(torch_dtype).to(brushnet.device) @@ -788,7 +788,7 @@ def brushnet_inference(x, timesteps, transformer_options): added_cond_kwargs = {} if do_classifier_free_guidance and step == 0: - print('BrushNet inference: do_classifier_free_guidance is True', len(transformer_options['cond_or_uncond']) > 1) + print('BrushNet inference: do_classifier_free_guidance is True') sub_idx = None if 'ad_params' in transformer_options and 'sub_idxs' in transformer_options['ad_params']: diff --git a/model_patch.py b/model_patch.py index 2c7e497..8dde60d 100644 --- a/model_patch.py +++ b/model_patch.py @@ -102,11 +102,11 @@ def modified_sample(model, noise, positive, negative, cfg, device, sampler, sigm # to = add_model_patch_option(model) to['model_patch']['all_sigmas'] = sigmas - - if math.isclose(cfg, 1.0) and model_options.get("disable_cfg1_optimization", False) == False: - to['model_patch']['free_guidance'] = False - else: - to['model_patch']['free_guidance'] = True + # + #if math.isclose(cfg, 1.0) and model_options.get("disable_cfg1_optimization", False) == False: + # to['model_patch']['free_guidance'] = False + #else: + # to['model_patch']['free_guidance'] = True # #######################################################################################