aboutsummaryrefslogtreecommitdiffstats
path: root/modules/sd_hijack_clip.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-07-15 05:41:22 +0000
committerAUTOMATIC1111 <16777216c@gmail.com>2023-07-15 05:41:22 +0000
commit2b1bae0d755c2d5201f6a6aadeadb5588208d43f (patch)
treeacb519133f2d9dee1b98a33d1be15d56c97ef4d9 /modules/sd_hijack_clip.py
parent127635409a7959f6c057a68ccb8e70734cbaf9f3 (diff)
downloadstable-diffusion-webui-gfx803-2b1bae0d755c2d5201f6a6aadeadb5588208d43f.tar.gz
stable-diffusion-webui-gfx803-2b1bae0d755c2d5201f6a6aadeadb5588208d43f.tar.bz2
stable-diffusion-webui-gfx803-2b1bae0d755c2d5201f6a6aadeadb5588208d43f.zip
add textual inversion hashes to infotext
Diffstat (limited to 'modules/sd_hijack_clip.py')
-rw-r--r--modules/sd_hijack_clip.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/modules/sd_hijack_clip.py b/modules/sd_hijack_clip.py
index 3b5a7666..c1d780a3 100644
--- a/modules/sd_hijack_clip.py
+++ b/modules/sd_hijack_clip.py
@@ -229,9 +229,18 @@ class FrozenCLIPEmbedderWithCustomWordsBase(torch.nn.Module):
z = self.process_tokens(tokens, multipliers)
zs.append(z)
- if len(used_embeddings) > 0:
- embeddings_list = ", ".join([f'{name} [{embedding.checksum()}]' for name, embedding in used_embeddings.items()])
- self.hijack.comments.append(f"Used embeddings: {embeddings_list}")
+ if opts.textual_inversion_add_hashes_to_infotext and used_embeddings:
+ hashes = []
+ for name, embedding in used_embeddings.items():
+ shorthash = embedding.shorthash
+ if not shorthash:
+ continue
+
+ name = name.replace(":", "").replace(",", "")
+ hashes.append(f"{name}: {shorthash}")
+
+ if hashes:
+ self.hijack.extra_generation_params["TI hashes"] = ", ".join(hashes)
return torch.hstack(zs)