Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
613b0d95
Commit
613b0d95
authored
Feb 08, 2024
by
v0xie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc: add boft comment
parent
325eaeb5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
extensions-builtin/Lora/network_oft.py
extensions-builtin/Lora/network_oft.py
+3
-3
No files found.
extensions-builtin/Lora/network_oft.py
View file @
613b0d95
...
...
@@ -29,13 +29,14 @@ class NetworkModuleOFT(network.NetworkModule):
self
.
oft_blocks
=
weights
.
w
[
"oft_blocks"
]
# (num_blocks, block_size, block_size)
self
.
alpha
=
weights
.
w
[
"alpha"
]
# alpha is constraint
self
.
dim
=
self
.
oft_blocks
.
shape
[
0
]
# lora dim
# LyCORIS
# LyCORIS
OFT
elif
"oft_diag"
in
weights
.
w
.
keys
():
self
.
is_kohya
=
False
self
.
oft_blocks
=
weights
.
w
[
"oft_diag"
]
# self.alpha is unused
self
.
dim
=
self
.
oft_blocks
.
shape
[
1
]
# (num_blocks, block_size, block_size)
# LyCORIS BOFT
self
.
is_boft
=
False
if
weights
.
w
[
"oft_diag"
]
.
dim
()
==
4
:
self
.
is_boft
=
True
...
...
@@ -89,6 +90,7 @@ class NetworkModuleOFT(network.NetworkModule):
)
merged_weight
=
rearrange
(
merged_weight
,
'k m ... -> (k m) ...'
)
else
:
# TODO: determine correct value for scale
scale
=
1.0
m
=
self
.
boft_m
b
=
self
.
boft_b
...
...
@@ -99,8 +101,6 @@ class NetworkModuleOFT(network.NetworkModule):
if
i
==
0
:
# Apply multiplier/scale and rescale into first weight
bi
=
bi
*
scale
+
(
1
-
scale
)
*
eye
#if self.rescaled:
# bi = bi * self.rescale
inp
=
rearrange
(
inp
,
"(c g k) ... -> (c k g) ..."
,
g
=
2
,
k
=
2
**
i
*
r_b
)
inp
=
rearrange
(
inp
,
"(d b) ... -> d b ..."
,
b
=
b
)
inp
=
torch
.
einsum
(
"b i j, b j ... -> b i ..."
,
bi
,
inp
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment