From b9d9c85966075005a574ea4d8a3df1c4c87f6d9e Mon Sep 17 00:00:00 2001 From: Muerrilla <48160881+muerrilla@users.noreply.github.com> Date: Tue, 23 May 2023 01:51:56 +0330 Subject: [PATCH] Support for new ControlNet --- scripts/npw.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/npw.py b/scripts/npw.py index 720d5e7..4f1a743 100644 --- a/scripts/npw.py +++ b/scripts/npw.py @@ -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)