Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stable-diffusion-webui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
stable-diffusion-webui
Commits
f2ae2529
Commit
f2ae2529
authored
Jan 19, 2023
by
EllangoK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes minor typos around run_modelmerger
parent
d1ea518d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
extras.py
modules/extras.py
+7
-7
No files found.
modules/extras.py
View file @
f2ae2529
...
...
@@ -275,7 +275,7 @@ def create_config(ckpt_result, config_source, a, b, c):
shutil
.
copyfile
(
cfg
,
checkpoint_filename
)
chckpoint_dict_skip_on_merge
=
[
"cond_stage_model.transformer.text_model.embeddings.position_ids"
]
ch
e
ckpoint_dict_skip_on_merge
=
[
"cond_stage_model.transformer.text_model.embeddings.position_ids"
]
def
to_half
(
tensor
,
enable
):
...
...
@@ -303,7 +303,7 @@ def run_modelmerger(id_task, primary_model_name, secondary_model_name, tertiary_
def
add_difference
(
theta0
,
theta1_2_diff
,
alpha
):
return
theta0
+
(
alpha
*
theta1_2_diff
)
def
filename_weighed_sum
():
def
filename_weigh
t
ed_sum
():
a
=
primary_model_info
.
model_name
b
=
secondary_model_info
.
model_name
Ma
=
round
(
1
-
multiplier
,
2
)
...
...
@@ -311,7 +311,7 @@ def run_modelmerger(id_task, primary_model_name, secondary_model_name, tertiary_
return
f
"{Ma}({a}) + {Mb}({b})"
def
filename_add_differ
ne
ce
():
def
filename_add_differ
en
ce
():
a
=
primary_model_info
.
model_name
b
=
secondary_model_info
.
model_name
c
=
tertiary_model_info
.
model_name
...
...
@@ -323,8 +323,8 @@ def run_modelmerger(id_task, primary_model_name, secondary_model_name, tertiary_
return
primary_model_info
.
model_name
theta_funcs
=
{
"Weighted sum"
:
(
filename_weighed_sum
,
None
,
weighted_sum
),
"Add difference"
:
(
filename_add_differ
ne
ce
,
get_difference
,
add_difference
),
"Weighted sum"
:
(
filename_weigh
t
ed_sum
,
None
,
weighted_sum
),
"Add difference"
:
(
filename_add_differ
en
ce
,
get_difference
,
add_difference
),
"No interpolation"
:
(
filename_nothing
,
None
,
None
),
}
filename_generator
,
theta_func1
,
theta_func2
=
theta_funcs
[
interp_method
]
...
...
@@ -362,7 +362,7 @@ def run_modelmerger(id_task, primary_model_name, secondary_model_name, tertiary_
shared
.
state
.
textinfo
=
'Merging B and C'
shared
.
state
.
sampling_steps
=
len
(
theta_1
.
keys
())
for
key
in
tqdm
.
tqdm
(
theta_1
.
keys
()):
if
key
in
chckpoint_dict_skip_on_merge
:
if
key
in
ch
e
ckpoint_dict_skip_on_merge
:
continue
if
'model'
in
key
:
...
...
@@ -387,7 +387,7 @@ def run_modelmerger(id_task, primary_model_name, secondary_model_name, tertiary_
for
key
in
tqdm
.
tqdm
(
theta_0
.
keys
()):
if
theta_1
and
'model'
in
key
and
key
in
theta_1
:
if
key
in
chckpoint_dict_skip_on_merge
:
if
key
in
ch
e
ckpoint_dict_skip_on_merge
:
continue
a
=
theta_0
[
key
]
...
...
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