aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrkirch <brkirch@users.noreply.github.com>2023-01-26 09:00:15 -0500
committerbrkirch <brkirch@users.noreply.github.com>2023-01-26 09:00:15 -0500
commitc4b9b07db6272768428fa8efeb7d7a9f22eca0b1 (patch)
treedbc25e218006a3821c4eaa401dd9f45364f8e946
parent645f4e7ef8c9d59deea7091a22373b2da2b780f2 (diff)
Fix embeddings dtype mismatch
-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 f9652d21..531790f3 100644
--- a/modules/sd_hijack.py
+++ b/modules/sd_hijack.py
@@ -171,7 +171,7 @@ class EmbeddingsWithFixes(torch.nn.Module):
vecs = []
for fixes, tensor in zip(batch_fixes, inputs_embeds):
for offset, embedding in fixes:
- emb = embedding.vec
+ emb = embedding.vec.to(devices.dtype_unet) if devices.unet_needs_upcast else embedding.vec
emb_len = min(tensor.shape[0] - offset - 1, emb.shape[0])
tensor = torch.cat([tensor[0:offset + 1], emb[0:emb_len], tensor[offset + 1 + emb_len:]])