aboutsummaryrefslogtreecommitdiffstats
path: root/modules/sd_hijack.py
diff options
context:
space:
mode:
authorGreg Fuller <gfuller23@gmail.com>2022-10-12 19:44:41 +0000
committerGreg Fuller <gfuller23@gmail.com>2022-10-12 19:44:41 +0000
commitfb3cefb348600497d964c4fd3f99138d7dde0ec5 (patch)
tree984c02da13dae6ab0d6c21304a551bbfffea02f2 /modules/sd_hijack.py
parentd717eb079cd6b7fa7a4f97c0a10d400bdec753fb (diff)
parent698d303b04e293635bfb49c525409f3bcf671dce (diff)
downloadstable-diffusion-webui-gfx803-fb3cefb348600497d964c4fd3f99138d7dde0ec5.tar.gz
stable-diffusion-webui-gfx803-fb3cefb348600497d964c4fd3f99138d7dde0ec5.tar.bz2
stable-diffusion-webui-gfx803-fb3cefb348600497d964c4fd3f99138d7dde0ec5.zip
Merge remote-tracking branch 'upstream/master' into interrogate_include_ranks_in_output
Diffstat (limited to 'modules/sd_hijack.py')
-rw-r--r--modules/sd_hijack.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/sd_hijack.py b/modules/sd_hijack.py
index ac70f876..c81722a0 100644
--- a/modules/sd_hijack.py
+++ b/modules/sd_hijack.py
@@ -321,7 +321,17 @@ class FrozenCLIPEmbedderWithCustomWords(torch.nn.Module):
fixes.append(fix[1])
self.hijack.fixes.append(fixes)
- z1 = self.process_tokens([x[:75] for x in remade_batch_tokens], [x[:75] for x in batch_multipliers])
+ tokens = []
+ multipliers = []
+ for j in range(len(remade_batch_tokens)):
+ if len(remade_batch_tokens[j]) > 0:
+ tokens.append(remade_batch_tokens[j][:75])
+ multipliers.append(batch_multipliers[j][:75])
+ else:
+ tokens.append([self.wrapped.tokenizer.eos_token_id] * 75)
+ multipliers.append([1.0] * 75)
+
+ z1 = self.process_tokens(tokens, multipliers)
z = z1 if z is None else torch.cat((z, z1), axis=-2)
remade_batch_tokens = rem_tokens