diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-07-17 06:00:47 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2023-07-17 06:00:47 +0000 |
commit | 238adeaffb037dedbcefe41e7fd4814a1f17baa2 (patch) | |
tree | 901557b4f4814effe18d23900317f7dbabf3e162 /extensions-builtin/Lora/lyco_helpers.py | |
parent | 46466f09d0b0c14118033dee6af0f876059776d3 (diff) | |
download | stable-diffusion-webui-gfx803-238adeaffb037dedbcefe41e7fd4814a1f17baa2.tar.gz stable-diffusion-webui-gfx803-238adeaffb037dedbcefe41e7fd4814a1f17baa2.tar.bz2 stable-diffusion-webui-gfx803-238adeaffb037dedbcefe41e7fd4814a1f17baa2.zip |
support specifying te and unet weights separately
update lora code
support full module
Diffstat (limited to 'extensions-builtin/Lora/lyco_helpers.py')
-rw-r--r-- | extensions-builtin/Lora/lyco_helpers.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/extensions-builtin/Lora/lyco_helpers.py b/extensions-builtin/Lora/lyco_helpers.py index 9ea499fb..279b34bc 100644 --- a/extensions-builtin/Lora/lyco_helpers.py +++ b/extensions-builtin/Lora/lyco_helpers.py @@ -13,3 +13,9 @@ def rebuild_conventional(up, down, shape, dyn_dim=None): up = up[:, :dyn_dim]
down = down[:dyn_dim, :]
return (up @ down).reshape(shape)
+
+
+def rebuild_cp_decomposition(up, down, mid):
+ up = up.reshape(up.size(0), -1)
+ down = down.reshape(down.size(0), -1)
+ return torch.einsum('n m k l, i n, m j -> i j k l', mid, up, down)
|