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
6f31d221
Commit
6f31d221
authored
Jan 27, 2023
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support detecting midas model
fix broken api for checkpoint list
parent
d2ac95fa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
models.py
modules/api/models.py
+1
-1
sd_models.py
modules/sd_models.py
+5
-5
sd_models_config.py
modules/sd_models_config.py
+5
-2
No files found.
modules/api/models.py
View file @
6f31d221
...
...
@@ -228,7 +228,7 @@ class SDModelItem(BaseModel):
hash
:
Optional
[
str
]
=
Field
(
title
=
"Short hash"
)
sha256
:
Optional
[
str
]
=
Field
(
title
=
"sha256 hash"
)
filename
:
str
=
Field
(
title
=
"Filename"
)
config
:
str
=
Field
(
title
=
"Config file"
)
config
:
Optional
[
str
]
=
Field
(
title
=
"Config file"
)
class
HypernetworkItem
(
BaseModel
):
name
:
str
=
Field
(
title
=
"Name"
)
...
...
modules/sd_models.py
View file @
6f31d221
...
...
@@ -439,12 +439,12 @@ def reload_model_weights(sd_model=None, info=None):
if
sd_model
.
sd_model_checkpoint
==
checkpoint_info
.
filename
:
return
if
shared
.
cmd_opts
.
lowvram
or
shared
.
cmd_opts
.
medvram
:
lowvram
.
send_everything_to_cpu
()
else
:
sd_model
.
to
(
devices
.
cpu
)
if
shared
.
cmd_opts
.
lowvram
or
shared
.
cmd_opts
.
medvram
:
lowvram
.
send_everything_to_cpu
()
else
:
sd_model
.
to
(
devices
.
cpu
)
sd_hijack
.
model_hijack
.
undo_hijack
(
sd_model
)
sd_hijack
.
model_hijack
.
undo_hijack
(
sd_model
)
timer
=
Timer
()
...
...
modules/sd_models_config.py
View file @
6f31d221
...
...
@@ -10,6 +10,7 @@ sd_repo_configs_path = os.path.join(paths.paths['Stable Diffusion'], "configs",
config_default
=
shared
.
sd_default_config
config_sd2
=
os
.
path
.
join
(
sd_repo_configs_path
,
"v2-inference.yaml"
)
config_sd2v
=
os
.
path
.
join
(
sd_repo_configs_path
,
"v2-inference-v.yaml"
)
config_depth_model
=
os
.
path
.
join
(
sd_repo_configs_path
,
"v2-midas-inference.yaml"
)
config_inpainting
=
os
.
path
.
join
(
sd_configs_path
,
"v1-inpainting-inference.yaml"
)
config_instruct_pix2pix
=
os
.
path
.
join
(
sd_configs_path
,
"instruct-pix2pix.yaml"
)
config_alt_diffusion
=
os
.
path
.
join
(
sd_configs_path
,
"alt-diffusion-inference.yaml"
)
...
...
@@ -22,7 +23,9 @@ def guess_model_config_from_state_dict(sd, filename):
sd2_cond_proj_weight
=
sd
.
get
(
'cond_stage_model.model.transformer.resblocks.0.attn.in_proj_weight'
,
None
)
diffusion_model_input
=
sd
.
get
(
'model.diffusion_model.input_blocks.0.0.weight'
,
None
)
roberta_weight
=
sd
.
get
(
'cond_stage_model.roberta.embeddings.word_embeddings.weight'
,
None
)
if
sd
.
get
(
'depth_model.model.pretrained.act_postprocess3.0.project.0.bias'
,
None
)
is
not
None
:
return
config_depth_model
if
sd2_cond_proj_weight
is
not
None
and
sd2_cond_proj_weight
.
shape
[
1
]
==
1024
:
if
re
.
search
(
re_parametrization_v
,
fn
)
or
"v2-1_768"
in
fn
:
...
...
@@ -36,7 +39,7 @@ def guess_model_config_from_state_dict(sd, filename):
if
diffusion_model_input
.
shape
[
1
]
==
8
:
return
config_instruct_pix2pix
if
roberta_weight
is
not
None
:
if
sd
.
get
(
'cond_stage_model.roberta.embeddings.word_embeddings.weight'
,
None
)
is
not
None
:
return
config_alt_diffusion
return
config_default
...
...
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