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
b15bbef7
Commit
b15bbef7
authored
May 08, 2023
by
AUTOMATIC1111
Committed by
GitHub
May 08, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10089 from AUTOMATIC1111/LoraFix
Fix some Lora's not working
parents
67c88419
c3eced22
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
extensions-builtin/Lora/lora.py
extensions-builtin/Lora/lora.py
+5
-1
No files found.
extensions-builtin/Lora/lora.py
View file @
b15bbef7
...
...
@@ -166,8 +166,10 @@ def load_lora(name, filename):
module
=
torch
.
nn
.
Linear
(
weight
.
shape
[
1
],
weight
.
shape
[
0
],
bias
=
False
)
elif
type
(
sd_module
)
==
torch
.
nn
.
MultiheadAttention
:
module
=
torch
.
nn
.
Linear
(
weight
.
shape
[
1
],
weight
.
shape
[
0
],
bias
=
False
)
elif
type
(
sd_module
)
==
torch
.
nn
.
Conv2d
:
elif
type
(
sd_module
)
==
torch
.
nn
.
Conv2d
and
weight
.
shape
[
2
:]
==
(
1
,
1
)
:
module
=
torch
.
nn
.
Conv2d
(
weight
.
shape
[
1
],
weight
.
shape
[
0
],
(
1
,
1
),
bias
=
False
)
elif
type
(
sd_module
)
==
torch
.
nn
.
Conv2d
and
weight
.
shape
[
2
:]
==
(
3
,
3
):
module
=
torch
.
nn
.
Conv2d
(
weight
.
shape
[
1
],
weight
.
shape
[
0
],
(
3
,
3
),
bias
=
False
)
else
:
print
(
f
'Lora layer {key_diffusers} matched a layer with unsupported type: {type(sd_module).__name__}'
)
continue
...
...
@@ -233,6 +235,8 @@ def lora_calc_updown(lora, module, target):
if
up
.
shape
[
2
:]
==
(
1
,
1
)
and
down
.
shape
[
2
:]
==
(
1
,
1
):
updown
=
(
up
.
squeeze
(
2
)
.
squeeze
(
2
)
@
down
.
squeeze
(
2
)
.
squeeze
(
2
))
.
unsqueeze
(
2
)
.
unsqueeze
(
3
)
elif
up
.
shape
[
2
:]
==
(
3
,
3
)
or
down
.
shape
[
2
:]
==
(
3
,
3
):
updown
=
torch
.
nn
.
functional
.
conv2d
(
down
.
permute
(
1
,
0
,
2
,
3
),
up
)
.
permute
(
1
,
0
,
2
,
3
)
else
:
updown
=
up
@
down
...
...
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