aboutsummaryrefslogtreecommitdiff
path: root/modules/sd_hijack.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-09-20 12:12:31 +0300
committerAUTOMATIC <16777216c@gmail.com>2022-09-20 12:12:31 +0300
commit90401d96a69f62e21bee11294a1fe800cbd8b7fa (patch)
treeb5aa7358c2fca0987849f20ac30cb82581283b24 /modules/sd_hijack.py
parent54a097a8186222ba193d1abaaec6b3c65670313d (diff)
fix a off by one error with embedding at the start of the sentence
Diffstat (limited to 'modules/sd_hijack.py')
-rw-r--r--modules/sd_hijack.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/sd_hijack.py b/modules/sd_hijack.py
index 145c5ab7..ec83c0cb 100644
--- a/modules/sd_hijack.py
+++ b/modules/sd_hijack.py
@@ -401,7 +401,7 @@ class EmbeddingsWithFixes(torch.nn.Module):
for offset, word in fixes:
emb = self.embeddings.word_embeddings[word]
emb_len = min(tensor.shape[0]-offset, emb.shape[0])
- tensor[offset:offset+emb_len] = self.embeddings.word_embeddings[word][0:emb_len]
+ tensor[offset+1:offset+1+emb_len] = self.embeddings.word_embeddings[word][0:emb_len]
return inputs_embeds