lycoris-lora 1.8.0.dev7__tar.gz → 1.8.0.dev8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/PKG-INFO +1 -1
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris/modules/locon.py +32 -8
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris_lora.egg-info/PKG-INFO +1 -1
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/setup.py +1 -1
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/.gitignore +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/Algo.md +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/Change.md +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/Demo.md +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/LICENSE.md +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/README.md +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/experiments/better_conv.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/experiments/better_conv_extract.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/experiments/concept_neuron.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/experiments/locon_extract_test.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/experiments/locon_merge_test.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/experiments/singular_value_test.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/experiments/sparse_bias_test.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/experiments/time_test.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/experiments/weakre_speed.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris/__init__.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris/kohya/__init__.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris/kohya/kohya_model_utils.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris/kohya/kohya_utils.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris/modules/__init__.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris/modules/dylora.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris/modules/glokr.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris/modules/glora.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris/modules/ia3.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris/modules/loha.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris/modules/lokr.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris/utils.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris_lora.egg-info/SOURCES.txt +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris_lora.egg-info/dependency_links.txt +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris_lora.egg-info/not-zip-safe +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris_lora.egg-info/requires.txt +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris_lora.egg-info/top_level.txt +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/requirements.txt +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/setup.cfg +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/tools/extract_locon.py +0 -0
- {lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/tools/merge.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: lycoris_lora
|
|
3
|
-
Version: 1.8.0.
|
|
3
|
+
Version: 1.8.0.dev8
|
|
4
4
|
Summary: Lora beYond Conventional methods, Other Rank adaptation Implementations for Stable diffusion
|
|
5
5
|
Home-page: https://github.com/KohakuBlueleaf/LyCORIS
|
|
6
6
|
Author: Shih-Ying Yeh(KohakuBlueLeaf), Yu-Guan Hsieh, Zhidong Gao
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import math
|
|
2
2
|
from weakref import ref
|
|
3
|
+
from collections import OrderedDict, abc as container_abcs
|
|
3
4
|
|
|
4
5
|
import torch
|
|
5
6
|
import torch.nn as nn
|
|
@@ -26,6 +27,7 @@ class LoConModule(nn.Module):
|
|
|
26
27
|
self.lora_dim = lora_dim
|
|
27
28
|
self.cp = False
|
|
28
29
|
|
|
30
|
+
self.scalar = nn.Parameter(torch.tensor(0.0))
|
|
29
31
|
if isinstance(org_module, nn.Conv2d):
|
|
30
32
|
# For general LoCon
|
|
31
33
|
in_dim = org_module.in_channels
|
|
@@ -64,7 +66,7 @@ class LoConModule(nn.Module):
|
|
|
64
66
|
|
|
65
67
|
# same as microsoft's
|
|
66
68
|
torch.nn.init.kaiming_uniform_(self.lora_down.weight, a=math.sqrt(5))
|
|
67
|
-
torch.nn.init.
|
|
69
|
+
torch.nn.init.kaiming_uniform_(self.lora_up.weight)
|
|
68
70
|
if self.cp:
|
|
69
71
|
torch.nn.init.kaiming_uniform_(self.lora_mid.weight, a=math.sqrt(5))
|
|
70
72
|
|
|
@@ -78,7 +80,33 @@ class LoConModule(nn.Module):
|
|
|
78
80
|
def make_weight(self, device=None):
|
|
79
81
|
wa = self.lora_up.weight.to(device)
|
|
80
82
|
wb = self.lora_down.weight.to(device)
|
|
81
|
-
return (wa.view(wa.size(0), -1) @ wb.view(wb.size(0), -1)).view(self.shape)
|
|
83
|
+
return (wa.view(wa.size(0), -1) @ wb.view(wb.size(0), -1)).view(self.shape) * self.scalar
|
|
84
|
+
|
|
85
|
+
def state_dict(self, *args, destination=None, prefix='', keep_vars=False):
|
|
86
|
+
# TODO: Remove `args` and the parsing logic when BC allows.
|
|
87
|
+
if len(args) > 0:
|
|
88
|
+
if destination is None:
|
|
89
|
+
destination = args[0]
|
|
90
|
+
if len(args) > 1 and prefix == '':
|
|
91
|
+
prefix = args[1]
|
|
92
|
+
if len(args) > 2 and keep_vars is False:
|
|
93
|
+
keep_vars = args[2]
|
|
94
|
+
# DeprecationWarning is ignored by default
|
|
95
|
+
|
|
96
|
+
if destination is None:
|
|
97
|
+
destination = OrderedDict()
|
|
98
|
+
destination._metadata = OrderedDict()
|
|
99
|
+
|
|
100
|
+
local_metadata = dict(version=self._version)
|
|
101
|
+
if hasattr(destination, "_metadata"):
|
|
102
|
+
destination._metadata[prefix[:-1]] = local_metadata
|
|
103
|
+
|
|
104
|
+
destination[f'{prefix}alpha'] = self.alpha
|
|
105
|
+
destination[f'{prefix}lora_up.weight'] = self.lora_up.weight * self.scalar
|
|
106
|
+
destination[f'{prefix}lora_down.weight'] = self.lora_down.weight
|
|
107
|
+
if self.cp:
|
|
108
|
+
destination[f'{prefix}lora_mid.weight'] = self.lora_mid.weight
|
|
109
|
+
return destination
|
|
82
110
|
|
|
83
111
|
@torch.no_grad()
|
|
84
112
|
def apply_max_norm(self, max_norm, device=None):
|
|
@@ -89,11 +117,7 @@ class LoConModule(nn.Module):
|
|
|
89
117
|
|
|
90
118
|
scaled = ratio.item() != 1.0
|
|
91
119
|
if scaled:
|
|
92
|
-
|
|
93
|
-
self.lora_up.weight *= ratio**(1/modules)
|
|
94
|
-
self.lora_down.weight *= ratio**(1/modules)
|
|
95
|
-
if self.cp:
|
|
96
|
-
self.lora_mid.weight *= ratio**(1/modules)
|
|
120
|
+
self.scalar *= ratio
|
|
97
121
|
|
|
98
122
|
return scaled, orig_norm*ratio
|
|
99
123
|
|
|
@@ -115,4 +139,4 @@ class LoConModule(nn.Module):
|
|
|
115
139
|
drop = drop.view(*[1]*(dims-1), -1)
|
|
116
140
|
mid = mid * drop
|
|
117
141
|
|
|
118
|
-
return self.org_forward(x) + self.dropout(self.lora_up(mid) * scale)
|
|
142
|
+
return self.org_forward(x) + self.dropout(self.lora_up(mid) * self.scalar * scale)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: lycoris-lora
|
|
3
|
-
Version: 1.8.0.
|
|
3
|
+
Version: 1.8.0.dev8
|
|
4
4
|
Summary: Lora beYond Conventional methods, Other Rank adaptation Implementations for Stable diffusion
|
|
5
5
|
Home-page: https://github.com/KohakuBlueleaf/LyCORIS
|
|
6
6
|
Author: Shih-Ying Yeh(KohakuBlueLeaf), Yu-Guan Hsieh, Zhidong Gao
|
|
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
|
|
|
3
3
|
setup(
|
|
4
4
|
name='lycoris_lora',
|
|
5
5
|
packages=find_packages(),
|
|
6
|
-
version='1.8.0.
|
|
6
|
+
version='1.8.0.dev8',
|
|
7
7
|
url='https://github.com/KohakuBlueleaf/LyCORIS',
|
|
8
8
|
description='Lora beYond Conventional methods, Other Rank adaptation Implementations for Stable diffusion',
|
|
9
9
|
author='Shih-Ying Yeh(KohakuBlueLeaf), Yu-Guan Hsieh, Zhidong Gao',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lycoris_lora-1.8.0.dev7 → lycoris_lora-1.8.0.dev8}/lycoris_lora.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|