diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2024-02-11 05:34:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-11 05:34:40 +0000 |
commit | 3732cf2f97be873f17b735221cca177f056bd478 (patch) | |
tree | aa51ad124586b108c419fd2c292a12fd251d9f9b /modules/sd_hijack_clip.py | |
parent | 2f1e2c492f4d8268deec341ceb858fc4e6efd039 (diff) | |
parent | c3c88ca8b46a19f48104d0421e14be28853b2a92 (diff) | |
download | stable-diffusion-webui-gfx803-3732cf2f97be873f17b735221cca177f056bd478.tar.gz stable-diffusion-webui-gfx803-3732cf2f97be873f17b735221cca177f056bd478.tar.bz2 stable-diffusion-webui-gfx803-3732cf2f97be873f17b735221cca177f056bd478.zip |
Merge pull request #14874 from hako-mikan/master
Add option to disable normalize embeddings after after calculating emphasis.
Diffstat (limited to 'modules/sd_hijack_clip.py')
-rw-r--r-- | modules/sd_hijack_clip.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/sd_hijack_clip.py b/modules/sd_hijack_clip.py index 8f29057a..89634fbf 100644 --- a/modules/sd_hijack_clip.py +++ b/modules/sd_hijack_clip.py @@ -279,7 +279,9 @@ class FrozenCLIPEmbedderWithCustomWordsBase(torch.nn.Module): original_mean = z.mean()
z = z * batch_multipliers.reshape(batch_multipliers.shape + (1,)).expand(z.shape)
new_mean = z.mean()
- z = z * (original_mean / new_mean)
+
+ if not getattr(opts, "disable_normalize_embeddings", False):
+ z = z * (original_mean / new_mean)
if pooled is not None:
z.pooled = pooled
|