Support for new ControlNet

main
Muerrilla 2023-05-23 01:51:56 +03:30 committed by GitHub
parent 72a934827f
commit b9d9c85966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -87,6 +87,9 @@ class Script(scripts.Script):
if uncond.shape[1] > self.empty_uncond.shape[1]:
num_concatenations = uncond.shape[1] // self.empty_uncond.shape[1]
empty_uncond_concat = torch.cat([self.empty_uncond] * num_concatenations, dim=1)
if uncond.shape[1] == empty_uncond_concat.shape[1] + 1:
# assuming it's controlnet's marks!
empty_uncond_concat = torch.cat([uncond[:, :1, :], empty_uncond_concat], dim=1)
new_uncond = torch.lerp(empty_uncond_concat, uncond, self.weight)
else:
new_uncond = torch.lerp(self.empty_uncond, uncond, self.weight)