do_classifier_guidance from cond_or_uncond

This commit is contained in:
nullquant
2024-05-17 01:36:36 +03:00
parent 8e2d8d9539
commit 9f7a117ed4
2 changed files with 8 additions and 8 deletions
+3 -3
View File
@@ -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']:
+5 -5
View File
@@ -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
#
#######################################################################################