diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-07-17 12:51:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-17 12:51:59 +0000 |
commit | 2164578738edba6f56c4e95409c56f9ccef442e0 (patch) | |
tree | eedb5d43663dc108f15e7b36ea51b0570e919c7b /extensions-builtin/Lora/network_full.py | |
parent | 05d23c78376ce73d3de932c7e7b8871914295675 (diff) | |
parent | 35510f7529dc05437a82496187ef06b852be9ab1 (diff) | |
download | stable-diffusion-webui-gfx803-2164578738edba6f56c4e95409c56f9ccef442e0.tar.gz stable-diffusion-webui-gfx803-2164578738edba6f56c4e95409c56f9ccef442e0.tar.bz2 stable-diffusion-webui-gfx803-2164578738edba6f56c4e95409c56f9ccef442e0.zip |
Merge pull request #11821 from AUTOMATIC1111/lora_lyco
lora extension rework to include other types of networks
Diffstat (limited to 'extensions-builtin/Lora/network_full.py')
-rw-r--r-- | extensions-builtin/Lora/network_full.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/extensions-builtin/Lora/network_full.py b/extensions-builtin/Lora/network_full.py new file mode 100644 index 00000000..109b4c2c --- /dev/null +++ b/extensions-builtin/Lora/network_full.py @@ -0,0 +1,22 @@ +import network
+
+
+class ModuleTypeFull(network.ModuleType):
+ def create_module(self, net: network.Network, weights: network.NetworkWeights):
+ if all(x in weights.w for x in ["diff"]):
+ return NetworkModuleFull(net, weights)
+
+ return None
+
+
+class NetworkModuleFull(network.NetworkModule):
+ def __init__(self, net: network.Network, weights: network.NetworkWeights):
+ super().__init__(net, weights)
+
+ self.weight = weights.w.get("diff")
+
+ def calc_updown(self, orig_weight):
+ output_shape = self.weight.shape
+ updown = self.weight.to(orig_weight.device, dtype=orig_weight.dtype)
+
+ return self.finalize_updown(updown, orig_weight, output_shape)
|