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
d10c4db5
Commit
d10c4db5
authored
Oct 19, 2023
by
v0xie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: formatting
parent
321680cc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
37 deletions
+2
-37
extensions-builtin/Lora/network_oft.py
extensions-builtin/Lora/network_oft.py
+2
-2
extensions-builtin/Lora/networks.py
extensions-builtin/Lora/networks.py
+0
-35
No files found.
extensions-builtin/Lora/network_oft.py
View file @
d10c4db5
extensions-builtin/Lora/networks.py
View file @
d10c4db5
...
...
@@ -170,10 +170,6 @@ def load_network(name, network_on_disk):
emb_dict
[
vec_name
]
=
weight
bundle_embeddings
[
emb_name
]
=
emb_dict
#if key_network_without_network_parts == "oft_unet":
# print(key_network_without_network_parts)
# pass
key
=
convert_diffusers_name_to_compvis
(
key_network_without_network_parts
,
is_sd2
)
sd_module
=
shared
.
sd_model
.
network_layer_mapping
.
get
(
key
,
None
)
...
...
@@ -196,31 +192,8 @@ def load_network(name, network_on_disk):
sd_module
=
shared
.
sd_model
.
network_layer_mapping
.
get
(
key
,
None
)
elif
sd_module
is
None
and
"oft_unet"
in
key_network_without_network_parts
:
# UNET_TARGET_REPLACE_MODULE_ALL_LINEAR = ["Transformer2DModel"]
# UNET_TARGET_REPLACE_MODULE_CONV2D_3X3 = ["ResnetBlock2D", "Downsample2D", "Upsample2D"]
UNET_TARGET_REPLACE_MODULE_ATTN_ONLY
=
[
"CrossAttention"
]
# TODO: Change matchedm odules based on whether all linear, conv, etc
key
=
key_network_without_network_parts
.
replace
(
"oft_unet"
,
"diffusion_model"
)
sd_module
=
shared
.
sd_model
.
network_layer_mapping
.
get
(
key
,
None
)
#key_no_suffix = key.rsplit("_to_", 1)[0]
## Match all modules of class CrossAttention
#replace_module_list = []
#for module_type in UNET_TARGET_REPLACE_MODULE_ATTN_ONLY:
# replace_module_list += [module for k, module in shared.sd_model.network_layer_mapping.items() if module_type in module.__class__.__name__]
#matched_module = replace_module_list.get(key_no_suffix, None)
#if key.endswith('to_q'):
# sd_module = matched_module.to_q or None
#if key.endswith('to_k'):
# sd_module = matched_module.to_k or None
#if key.endswith('to_v'):
# sd_module = matched_module.to_v or None
#if key.endswith('to_out_0'):
# sd_module = matched_module.to_out[0] or None
#if key.endswith('to_out_1'):
# sd_module = matched_module.to_out[1] or None
if
sd_module
is
None
:
keys_failed_to_match
[
key_network
]
=
key
...
...
@@ -243,14 +216,6 @@ def load_network(name, network_on_disk):
net
.
modules
[
key
]
=
net_module
# replaces forward method of original Linear
# applied_to_count = 0
#for key, created_module in net.modules.items():
# if isinstance(created_module, network_oft.NetworkModuleOFT):
# net_module.apply_to()
#applied_to_count += 1
# print(f'Applied OFT modules: {applied_to_count}')
embeddings
=
{}
for
emb_name
,
data
in
bundle_embeddings
.
items
():
embedding
=
textual_inversion
.
create_embedding_from_data
(
data
,
emb_name
,
filename
=
network_on_disk
.
filename
+
"/"
+
emb_name
)
...
...
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