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
4c9c2a67
Commit
4c9c2a67
authored
Sep 28, 2022
by
Bernard Maltais
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
-Fix interp_amount rounding in filename
-Sort list of checkpoints in list
parent
8c48ede1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
extras.py
modules/extras.py
+2
-2
ui.py
modules/ui.py
+1
-1
No files found.
modules/extras.py
View file @
4c9c2a67
...
@@ -186,9 +186,9 @@ def run_modelmerger(primary_model_name, secondary_model_name, interp_method, int
...
@@ -186,9 +186,9 @@ def run_modelmerger(primary_model_name, secondary_model_name, interp_method, int
if
'model'
in
key
and
key
not
in
theta_0
:
if
'model'
in
key
and
key
not
in
theta_0
:
theta_0
[
key
]
=
theta_1
[
key
]
theta_0
[
key
]
=
theta_1
[
key
]
output_modelname
=
'models/'
+
primary_model_name
+
'_'
+
str
(
interp_amount
)
+
'-'
+
secondary_model_name
+
'_'
+
str
(
float
(
1.0
)
-
interp_amount
)
+
'-'
+
interp_method
.
replace
(
" "
,
"_"
)
+
'-merged.ckpt'
output_modelname
=
'models/'
+
primary_model_name
+
'_'
+
str
(
round
(
interp_amount
,
2
))
+
'-'
+
secondary_model_name
+
'_'
+
str
(
round
((
float
(
1.0
)
-
interp_amount
),
2
)
)
+
'-'
+
interp_method
.
replace
(
" "
,
"_"
)
+
'-merged.ckpt'
print
(
f
"Saving to {output_modelname}..."
)
print
(
f
"Saving to {output_modelname}..."
)
torch
.
save
(
primary_model
,
output_modelname
)
torch
.
save
(
primary_model
,
output_modelname
)
print
(
f
"Checkpoint saved."
)
print
(
f
"Checkpoint saved."
)
return
"Checkpoint saved to "
+
output_modelname
return
"Checkpoint saved to "
+
output_modelname
\ No newline at end of file
modules/ui.py
View file @
4c9c2a67
...
@@ -860,7 +860,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
...
@@ -860,7 +860,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
gr
.
HTML
(
value
=
"<p>A merger of the two checkpoints will be generated in your <b>/models</b> directory.</p>"
)
gr
.
HTML
(
value
=
"<p>A merger of the two checkpoints will be generated in your <b>/models</b> directory.</p>"
)
with
gr
.
Row
():
with
gr
.
Row
():
ckpt_name_list
=
[
x
.
model_name
for
x
in
modules
.
sd_models
.
checkpoints_list
.
values
()]
ckpt_name_list
=
sorted
([
x
.
model_name
for
x
in
modules
.
sd_models
.
checkpoints_list
.
values
()])
primary_model_name
=
gr
.
Dropdown
(
ckpt_name_list
,
elem_id
=
"modelmerger_primary_model_name"
,
label
=
"Primary Model Name"
)
primary_model_name
=
gr
.
Dropdown
(
ckpt_name_list
,
elem_id
=
"modelmerger_primary_model_name"
,
label
=
"Primary Model Name"
)
secondary_model_name
=
gr
.
Dropdown
(
ckpt_name_list
,
elem_id
=
"modelmerger_secondary_model_name"
,
label
=
"Secondary Model Name"
)
secondary_model_name
=
gr
.
Dropdown
(
ckpt_name_list
,
elem_id
=
"modelmerger_secondary_model_name"
,
label
=
"Secondary Model Name"
)
interp_amount
=
gr
.
Slider
(
minimum
=
0.0
,
maximum
=
1.0
,
step
=
0.05
,
label
=
'Interpolation Amount'
,
value
=
0.3
)
interp_amount
=
gr
.
Slider
(
minimum
=
0.0
,
maximum
=
1.0
,
step
=
0.05
,
label
=
'Interpolation Amount'
,
value
=
0.3
)
...
...
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