lycoris-lora 1.9.0.dev7__tar.gz → 1.9.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.9.0.dev7 → lycoris_lora-1.9.0.dev8}/PKG-INFO +1 -1
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/kohya/__init__.py +2 -0
- lycoris_lora-1.9.0.dev8/lycoris/modules/full.py +85 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris_lora.egg-info/PKG-INFO +1 -1
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris_lora.egg-info/SOURCES.txt +1 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/setup.py +1 -1
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/.gitignore +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/Algo.md +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/Change.md +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/Demo.md +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/LICENSE.md +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/README.md +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/experiments/better_conv.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/experiments/better_conv_extract.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/experiments/compare_norm.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/experiments/concept_neuron.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/experiments/locon_extract_test.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/experiments/locon_merge_test.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/experiments/loha_svd.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/experiments/singular_value_test.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/experiments/sparse_bias_test.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/experiments/time_test.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/experiments/weakre_speed.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/hyperdream_gen_weight.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/__init__.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/config.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/kohya/model_utils.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/kohya/original_unet.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/kohya/sdxl_model_util.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/kohya/sdxl_original_unet.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/kohya/utils.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/modules/__init__.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/modules/attention.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/modules/dylora.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/modules/glokr.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/modules/glora.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/modules/hyperlycoris.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/modules/hypernet/__init__.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/modules/hypernet/generater.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/modules/hypernet/text_encoder.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/modules/ia3.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/modules/locon.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/modules/loha.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/modules/lokr.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/modules/norms.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/utils/__init__.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/utils/preset.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris/utils/xformers_utils.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris_lora.egg-info/dependency_links.txt +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris_lora.egg-info/not-zip-safe +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris_lora.egg-info/requires.txt +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/lycoris_lora.egg-info/top_level.txt +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/requirements.txt +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/setup.cfg +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/tools/extract_locon.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/tools/merge.py +0 -0
- {lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/train_hyperdream.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: lycoris_lora
|
|
3
|
-
Version: 1.9.0.
|
|
3
|
+
Version: 1.9.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
|
|
@@ -19,6 +19,7 @@ from ..modules.lokr import LokrModule
|
|
|
19
19
|
from ..modules.dylora import DyLoraModule
|
|
20
20
|
from ..modules.glora import GLoRAModule
|
|
21
21
|
from ..modules.norms import NormModule
|
|
22
|
+
from ..modules.full import FullModule
|
|
22
23
|
|
|
23
24
|
from ..config import PRESET
|
|
24
25
|
from ..utils.preset import read_preset
|
|
@@ -46,6 +47,7 @@ def create_network(multiplier, network_dim, network_alpha, vae, text_encoder, un
|
|
|
46
47
|
'lokr': LokrModule,
|
|
47
48
|
'dylora': DyLoraModule,
|
|
48
49
|
'glora': GLoRAModule,
|
|
50
|
+
'full': FullModule,
|
|
49
51
|
}[algo]
|
|
50
52
|
|
|
51
53
|
if algo == 'glora' and conv_dim>0:
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import math
|
|
2
|
+
from weakref import ref
|
|
3
|
+
from collections import OrderedDict, abc as container_abcs
|
|
4
|
+
|
|
5
|
+
import torch
|
|
6
|
+
import torch.nn as nn
|
|
7
|
+
import torch.nn.functional as F
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class FullModule(nn.Module):
|
|
11
|
+
"""
|
|
12
|
+
modifed from kohya-ss/sd-scripts/networks/lora:LoRAModule
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(
|
|
16
|
+
self,
|
|
17
|
+
lora_name, org_module: nn.Module,
|
|
18
|
+
multiplier=1.0,
|
|
19
|
+
lora_dim=4, alpha=1,
|
|
20
|
+
dropout=0., rank_dropout=0., module_dropout=0.,
|
|
21
|
+
use_cp=False, use_scalar=False,
|
|
22
|
+
**kwargs,
|
|
23
|
+
):
|
|
24
|
+
""" if alpha == 0 or None, alpha is rank (no scaling). """
|
|
25
|
+
super().__init__()
|
|
26
|
+
self.lora_name = lora_name
|
|
27
|
+
|
|
28
|
+
if isinstance(org_module, nn.Linear):
|
|
29
|
+
self.op = F.linear
|
|
30
|
+
self.dim = org_module.out_features
|
|
31
|
+
self.kw_dict = {}
|
|
32
|
+
elif isinstance(org_module, nn.Conv2d):
|
|
33
|
+
self.op = F.conv2d
|
|
34
|
+
self.dim = org_module.out_channels
|
|
35
|
+
self.kw_dict = {
|
|
36
|
+
"stride": org_module.stride,
|
|
37
|
+
"padding": org_module.padding,
|
|
38
|
+
"dilation": org_module.dilation,
|
|
39
|
+
"groups": org_module.groups,
|
|
40
|
+
}
|
|
41
|
+
else:
|
|
42
|
+
raise NotImplementedError
|
|
43
|
+
self.diff = nn.Parameter(torch.zeros_like(org_module.weight))
|
|
44
|
+
if org_module.bias is not None:
|
|
45
|
+
self.diff_b = nn.Parameter(torch.zeros_like(org_module.bias))
|
|
46
|
+
else:
|
|
47
|
+
self.diff_b = None
|
|
48
|
+
|
|
49
|
+
self.rank_dropout = rank_dropout
|
|
50
|
+
self.module_dropout = module_dropout
|
|
51
|
+
|
|
52
|
+
self.multiplier = multiplier
|
|
53
|
+
self.org_module = [org_module]
|
|
54
|
+
|
|
55
|
+
def apply_to(self, **kwargs):
|
|
56
|
+
self.org_forward = self.org_module[0].forward
|
|
57
|
+
self.org_module[0].forward = self.forward
|
|
58
|
+
|
|
59
|
+
def make_weight(self, scale = 1, device=None):
|
|
60
|
+
drop = (
|
|
61
|
+
torch.rand(self.dim, device=device) < self.rank_dropout
|
|
62
|
+
if self.rank_dropout and self.training
|
|
63
|
+
else 1
|
|
64
|
+
)
|
|
65
|
+
org_weight = self.org_module[0].weight.to(device)
|
|
66
|
+
weight = self.diff.to(device) * drop * scale
|
|
67
|
+
weight = weight + org_weight
|
|
68
|
+
|
|
69
|
+
if self.diff_b is not None:
|
|
70
|
+
org_bias = self.org_module[0].bias.to(device)
|
|
71
|
+
bias = self.diff_b.to(device) * drop * scale
|
|
72
|
+
bias = bias + org_bias
|
|
73
|
+
else:
|
|
74
|
+
bias = None
|
|
75
|
+
return weight, bias
|
|
76
|
+
|
|
77
|
+
def forward(self, x):
|
|
78
|
+
if self.module_dropout and self.training:
|
|
79
|
+
if torch.rand(1) < self.module_dropout:
|
|
80
|
+
return self.org_forward(x)
|
|
81
|
+
scale = self.multiplier
|
|
82
|
+
|
|
83
|
+
w, b = self.make_weight(scale, x.device)
|
|
84
|
+
kw_dict = self.kw_dict | {"weight": w, "bias": b}
|
|
85
|
+
return self.op(x, **kw_dict)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: lycoris-lora
|
|
3
|
-
Version: 1.9.0.
|
|
3
|
+
Version: 1.9.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.9.0.
|
|
6
|
+
version='1.9.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.0.dev8}/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
|
{lycoris_lora-1.9.0.dev7 → lycoris_lora-1.9.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
|
|
File without changes
|