do_classifier_guidance from cond_or_uncond
This commit is contained in:
+3
-3
@@ -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
@@ -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
|
||||
#
|
||||
#######################################################################################
|
||||
|
||||
|
||||
Reference in New Issue
Block a user