lycoris-lora 2.1.0.dev1__tar.gz → 2.1.0.dev3__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-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/PKG-INFO +1 -1
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/README.md +35 -3
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/modules/__init__.py +3 -3
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/utils/__init__.py +2 -2
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/wrapper.py +19 -1
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris_lora.egg-info/PKG-INFO +1 -1
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/setup.py +1 -1
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/LICENSE.md +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/__init__.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/config.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/hcp/__init__.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/hcp/base.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/hcp/diag_oft.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/hcp/loha.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/hcp/lokr.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/kohya/__init__.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/kohya/model_utils.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/kohya/original_unet.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/kohya/sdxl_model_util.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/kohya/sdxl_original_unet.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/kohya/utils.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/modules/attention.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/modules/base.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/modules/diag_oft.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/modules/dylora.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/modules/full.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/modules/glokr.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/modules/glora.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/modules/hypernet/__init__.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/modules/hypernet/generater.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/modules/hypernet/text_encoder.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/modules/ia3.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/modules/locon.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/modules/loha.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/modules/lokr.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/modules/norms.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/utils/logger.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/utils/preset.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/utils/xformers_utils.py +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris_lora.egg-info/SOURCES.txt +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris_lora.egg-info/dependency_links.txt +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris_lora.egg-info/not-zip-safe +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris_lora.egg-info/requires.txt +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris_lora.egg-info/top_level.txt +0 -0
- {lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: lycoris_lora
|
|
3
|
-
Version: 2.1.0.
|
|
3
|
+
Version: 2.1.0.dev3
|
|
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
|
|
@@ -100,7 +100,8 @@ You can use this package's kohya module to run kohya's training script to train
|
|
|
100
100
|
|
|
101
101
|
```bash
|
|
102
102
|
accelerate launch train_network.py \
|
|
103
|
-
--config_file example_configs/training_configs/kohya/loha_config.toml
|
|
103
|
+
--config_file example_configs/training_configs/kohya/loha_config.toml \
|
|
104
|
+
--dataset_config example_configs/training_configs/kohya/dataset_config.toml
|
|
104
105
|
```
|
|
105
106
|
|
|
106
107
|
For your convenience, some example `toml` files for kohya LyCORIS training are provided in [example/training_configs/kohya](example_configs/training_configs/kohya).
|
|
@@ -120,6 +121,7 @@ For the moment being the outputs of HCP-Diffusion are not directly compatible wi
|
|
|
120
121
|
You can perform conversion with [tools/batch_hcp_convert.py](tools/batch_hcp_convert.py).
|
|
121
122
|
|
|
122
123
|
In the case of pivotal tuning, [tools/batch_bundle_convert.py](tools/batch_bundle_convert.py) can be further used to convert to and from bundle formats.
|
|
124
|
+
Check [docs/Conversion-scripts.md](docs/Conversion-scripts.md) for more information.
|
|
123
125
|
|
|
124
126
|
#### As standalone wrappers
|
|
125
127
|
|
|
@@ -151,7 +153,7 @@ forward_with_lyco = your_model(x)
|
|
|
151
153
|
|
|
152
154
|
You can check my [HakuPhi](https://github.com/KohakuBlueleaf/HakuPhi) project to see how I utilize LyCORIS to finetune the Phi-1.5 models.
|
|
153
155
|
|
|
154
|
-
#### Graphical
|
|
156
|
+
#### Graphical interfaces and Colabs (via kohya trainer)
|
|
155
157
|
|
|
156
158
|
You can also train LyCORIS with the following graphical interfaces
|
|
157
159
|
|
|
@@ -189,7 +191,7 @@ usage: extract_locon.py [-h] [--is_v2] [--is_sdxl] [--device DEVICE] [--mode MOD
|
|
|
189
191
|
|
|
190
192
|
### Merge LyCORIS back to model
|
|
191
193
|
|
|
192
|
-
You can merge your LyCORIS model back to your checkpoint(base model)
|
|
194
|
+
You can merge your LyCORIS model back to your checkpoint (base model).
|
|
193
195
|
|
|
194
196
|
```bash
|
|
195
197
|
python3 merge.py <settings> <base_model> <lycoris_model> <output>
|
|
@@ -202,6 +204,36 @@ $ python3 merge.py --help
|
|
|
202
204
|
usage: merge.py [-h] [--is_v2] [--is_sdxl] [--device DEVICE] [--dtype DTYPE] [--weight WEIGHT] base_model lycoris_model output_name
|
|
203
205
|
```
|
|
204
206
|
|
|
207
|
+
### Conversion of LoRA, LyCORIS and full models between HCP and sd-webui format
|
|
208
|
+
|
|
209
|
+
This script allows you to use the LyCORIS models trained with HCP-Diffusion in sd-webui.
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
python3 batch_hcp_convert.py \
|
|
213
|
+
--network_path /path/to/ckpts \
|
|
214
|
+
--dst_dir /path/to/stable-diffusion-webui/models/Lora \
|
|
215
|
+
--output_prefix something \
|
|
216
|
+
--auto_scale_alpha --to_webui
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
See [docs/Conversion-scripts.md](docs/Conversion-scripts.md) for more information.
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
### Conversion from and to bundle format
|
|
223
|
+
|
|
224
|
+
This script is particularly useful in the case of pivotal tuning.
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
python3 batch_bundle_convert.py \
|
|
228
|
+
--network_path /path/to/sd-webui-ssd/models/Lora \
|
|
229
|
+
--emb_path /path/to/ckpts \
|
|
230
|
+
--dst_dir /path/to/sd-webui-ssd/models/Lora/bundle \
|
|
231
|
+
--to_bundle --verbose 2
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
See [docs/Conversion-scripts.md](docs/Conversion-scripts.md) for more information.
|
|
235
|
+
|
|
236
|
+
|
|
205
237
|
## Change Log
|
|
206
238
|
|
|
207
239
|
For full log, please see [Change.md](Change.md)
|
|
@@ -18,7 +18,7 @@ def make_module(lyco_type, params, lora_name, orig_module):
|
|
|
18
18
|
orig_module,
|
|
19
19
|
1,
|
|
20
20
|
down.size(0),
|
|
21
|
-
|
|
21
|
+
float(alpha),
|
|
22
22
|
use_cp=mid is not None,
|
|
23
23
|
)
|
|
24
24
|
module.lora_up.weight.data.copy_(up)
|
|
@@ -28,7 +28,7 @@ def make_module(lyco_type, params, lora_name, orig_module):
|
|
|
28
28
|
elif lyco_type == "hada":
|
|
29
29
|
w1a, w1b, w2a, w2b, t1, t2, alpha = params
|
|
30
30
|
module = LohaModule(
|
|
31
|
-
lora_name, orig_module, 1, w1b.size(0), alpha
|
|
31
|
+
lora_name, orig_module, 1, w1b.size(0), float(alpha), use_cp=t1 is not None
|
|
32
32
|
)
|
|
33
33
|
module.hada_w1_a.copy_(w1a)
|
|
34
34
|
module.hada_w1_b.copy_(w1b)
|
|
@@ -74,7 +74,7 @@ def make_module(lyco_type, params, lora_name, orig_module):
|
|
|
74
74
|
orig_module,
|
|
75
75
|
1,
|
|
76
76
|
lora_dim,
|
|
77
|
-
|
|
77
|
+
float(alpha),
|
|
78
78
|
use_cp=t2 is not None,
|
|
79
79
|
decompose_both=w1 is None and w2 is None,
|
|
80
80
|
factor=factor,
|
|
@@ -373,7 +373,7 @@ def extract_diff(
|
|
|
373
373
|
return loras
|
|
374
374
|
|
|
375
375
|
all_loras = {}
|
|
376
|
-
for idx, te1, te2 in enumerate(zip(base_tes, db_tes)):
|
|
376
|
+
for idx, (te1, te2) in enumerate(zip(base_tes, db_tes)):
|
|
377
377
|
if len(base_tes) > 1:
|
|
378
378
|
prefix = f"{LORA_PREFIX_TEXT_ENCODER}{idx+1}"
|
|
379
379
|
else:
|
|
@@ -685,7 +685,7 @@ def merge(tes, unet, lyco_state_dict, scale: float = 1.0, device="cpu"):
|
|
|
685
685
|
)
|
|
686
686
|
|
|
687
687
|
for idx, te in enumerate(tes):
|
|
688
|
-
if len(tes):
|
|
688
|
+
if len(tes)>1:
|
|
689
689
|
prefix = LORA_PREFIX_TEXT_ENCODER + str(idx + 1)
|
|
690
690
|
else:
|
|
691
691
|
prefix = LORA_PREFIX_TEXT_ENCODER
|
|
@@ -146,7 +146,8 @@ def create_lycoris_from_weights(multiplier, file, module, weights_sd=None, **kwa
|
|
|
146
146
|
if lora_name in loras:
|
|
147
147
|
loras[lora_name] = modules
|
|
148
148
|
|
|
149
|
-
network = LycorisNetwork(module)
|
|
149
|
+
network = LycorisNetwork(module, init_only=True)
|
|
150
|
+
network.multiplier = multiplier
|
|
150
151
|
network.loras = []
|
|
151
152
|
|
|
152
153
|
for lora_name, orig_modules in loras.items():
|
|
@@ -156,6 +157,9 @@ def create_lycoris_from_weights(multiplier, file, module, weights_sd=None, **kwa
|
|
|
156
157
|
module = make_module(lyco_type, params, lora_name, orig_modules)
|
|
157
158
|
if module is not None:
|
|
158
159
|
network.loras.append(module)
|
|
160
|
+
network.algo_table[module.__class__.__name__] = (
|
|
161
|
+
network.algo_table.get(module.__class__.__name__, 0) + 1
|
|
162
|
+
)
|
|
159
163
|
|
|
160
164
|
for lora in network.loras:
|
|
161
165
|
lora.multiplier = multiplier
|
|
@@ -200,10 +204,24 @@ class LycorisNetwork(torch.nn.Module):
|
|
|
200
204
|
network_module: str = "locon",
|
|
201
205
|
norm_modules=NormModule,
|
|
202
206
|
train_norm=False,
|
|
207
|
+
init_only=False,
|
|
203
208
|
**kwargs,
|
|
204
209
|
) -> None:
|
|
205
210
|
super().__init__()
|
|
206
211
|
root_kwargs = kwargs
|
|
212
|
+
if init_only:
|
|
213
|
+
self.multiplier = 1
|
|
214
|
+
self.lora_dim = 0
|
|
215
|
+
self.alpha = 1
|
|
216
|
+
self.conv_lora_dim = 0
|
|
217
|
+
self.conv_alpha = 1
|
|
218
|
+
self.dropout = 0
|
|
219
|
+
self.rank_dropout = 0
|
|
220
|
+
self.module_dropout = 0
|
|
221
|
+
self.use_tucker = False
|
|
222
|
+
self.loras = []
|
|
223
|
+
self.algo_table = {}
|
|
224
|
+
return
|
|
207
225
|
self.multiplier = multiplier
|
|
208
226
|
self.lora_dim = lora_dim
|
|
209
227
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: lycoris-lora
|
|
3
|
-
Version: 2.1.0.
|
|
3
|
+
Version: 2.1.0.dev3
|
|
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
|
|
@@ -4,7 +4,7 @@ from setuptools import setup, find_packages
|
|
|
4
4
|
setup(
|
|
5
5
|
name="lycoris_lora",
|
|
6
6
|
packages=find_packages(),
|
|
7
|
-
version="2.1.0.
|
|
7
|
+
version="2.1.0.dev3",
|
|
8
8
|
url="https://github.com/KohakuBlueleaf/LyCORIS",
|
|
9
9
|
description="Lora beYond Conventional methods, Other Rank adaptation Implementations for Stable diffusion",
|
|
10
10
|
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
|
{lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris/modules/hypernet/text_encoder.py
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
|
|
File without changes
|
|
File without changes
|
{lycoris_lora-2.1.0.dev1 → lycoris_lora-2.1.0.dev3}/lycoris_lora.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|