diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-07-19 07:59:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-19 07:59:39 +0300 |
commit | 0a334b447ff0c41519bb9e280050736913ad9cf8 (patch) | |
tree | e27963f76b7357ff0cb7b2c3fdcb720ab64f0e50 /extensions-builtin/Lora/network_full.py | |
parent | 6094310704f4b3853bfa5d05d9c1ace58b2deee7 (diff) | |
parent | c2b975485708791b29d44d79ee1a48d3abd838b7 (diff) |
Merge branch 'dev' into allow-no-venv-install
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)
|