Handle XL/1.5 switch during Hires Fix

main
Muerrilla 2024-06-28 23:38:02 +03:30 committed by GitHub
parent 5a9ec7fbc7
commit 356a3c05fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 3 deletions

View File

@ -56,6 +56,8 @@ class Script(scripts.Script):
weight = getattr(p, 'NPW_weight', weight)
if weight != 1 : self.print_warning(weight)
self.width = p.width
self.height = p.height
self.weight = weight
self.empty_uncond = None
@ -66,7 +68,7 @@ class Script(scripts.Script):
# print('NPW callback removed')
if self.weight != 1.0:
self.empty_uncond = self.make_empty_uncond(p.width, p.height)
self.empty_uncond = self.make_empty_uncond(self.width, self.height)
on_cfg_denoiser(self.denoiser_callback)
# print('NPW callback added')
self.callbacks_added = True
@ -99,8 +101,10 @@ class Script(scripts.Script):
return new_tensor
uncond = params.text_uncond
empty_uncond = self.empty_uncond
is_dict = isinstance(uncond, dict)
if type(self.empty_uncond) != type(uncond):
self.empty_uncond = self.make_empty_uncond(self.width, self.height)
empty_uncond = self.empty_uncond
if is_dict:
uncond, cross = uncond['vector'], uncond['crossattn']