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
4b43480f
Commit
4b43480f
authored
Aug 01, 2023
by
AUTOMATIC1111
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show metadata for SD checkpoints in the extra networks UI
parent
c10633f9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
10 deletions
+17
-10
modules/sd_models.py
modules/sd_models.py
+16
-10
modules/ui_extra_networks_checkpoints.py
modules/ui_extra_networks_checkpoints.py
+1
-0
No files found.
modules/sd_models.py
View file @
4b43480f
...
...
@@ -14,7 +14,7 @@ import ldm.modules.midas as midas
from
ldm.util
import
instantiate_from_config
from
modules
import
paths
,
shared
,
modelloader
,
devices
,
script_callbacks
,
sd_vae
,
sd_disable_initialization
,
errors
,
hashes
,
sd_models_config
,
sd_unet
,
sd_models_xl
from
modules
import
paths
,
shared
,
modelloader
,
devices
,
script_callbacks
,
sd_vae
,
sd_disable_initialization
,
errors
,
hashes
,
sd_models_config
,
sd_unet
,
sd_models_xl
,
cache
from
modules.sd_hijack_inpainting
import
do_inpainting_hijack
from
modules.timer
import
Timer
import
tomesd
...
...
@@ -33,6 +33,8 @@ class CheckpointInfo:
self
.
filename
=
filename
abspath
=
os
.
path
.
abspath
(
filename
)
self
.
is_safetensors
=
os
.
path
.
splitext
(
filename
)[
1
]
.
lower
()
==
".safetensors"
if
shared
.
cmd_opts
.
ckpt_dir
is
not
None
and
abspath
.
startswith
(
shared
.
cmd_opts
.
ckpt_dir
):
name
=
abspath
.
replace
(
shared
.
cmd_opts
.
ckpt_dir
,
''
)
elif
abspath
.
startswith
(
model_path
):
...
...
@@ -43,6 +45,19 @@ class CheckpointInfo:
if
name
.
startswith
(
"
\\
"
)
or
name
.
startswith
(
"/"
):
name
=
name
[
1
:]
def
read_metadata
():
metadata
=
read_metadata_from_safetensors
(
filename
)
self
.
modelspec_thumbnail
=
metadata
.
pop
(
'modelspec.thumbnail'
,
None
)
return
metadata
self
.
metadata
=
{}
if
self
.
is_safetensors
:
try
:
self
.
metadata
=
cache
.
cached_data_for_file
(
'safetensors-metadata'
,
"checkpoint/"
+
name
,
filename
,
read_metadata
)
except
Exception
as
e
:
errors
.
display
(
e
,
f
"reading metadata for {filename}"
)
self
.
name
=
name
self
.
name_for_extra
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
filename
))[
0
]
self
.
model_name
=
os
.
path
.
splitext
(
name
.
replace
(
"/"
,
"_"
)
.
replace
(
"
\\
"
,
"_"
))[
0
]
...
...
@@ -55,15 +70,6 @@ class CheckpointInfo:
self
.
ids
=
[
self
.
hash
,
self
.
model_name
,
self
.
title
,
name
,
f
'{name} [{self.hash}]'
]
+
([
self
.
shorthash
,
self
.
sha256
,
f
'{self.name} [{self.shorthash}]'
]
if
self
.
shorthash
else
[])
self
.
metadata
=
{}
_
,
ext
=
os
.
path
.
splitext
(
self
.
filename
)
if
ext
.
lower
()
==
".safetensors"
:
try
:
self
.
metadata
=
read_metadata_from_safetensors
(
filename
)
except
Exception
as
e
:
errors
.
display
(
e
,
f
"reading checkpoint metadata: {filename}"
)
def
register
(
self
):
checkpoints_list
[
self
.
title
]
=
self
for
id
in
self
.
ids
:
...
...
modules/ui_extra_networks_checkpoints.py
View file @
4b43480f
...
...
@@ -23,6 +23,7 @@ class ExtraNetworksPageCheckpoints(ui_extra_networks.ExtraNetworksPage):
"search_term"
:
self
.
search_terms_from_path
(
checkpoint
.
filename
)
+
" "
+
(
checkpoint
.
sha256
or
""
),
"onclick"
:
'"'
+
html
.
escape
(
f
"""return selectCheckpoint({quote_js(name)})"""
)
+
'"'
,
"local_preview"
:
f
"{path}.{shared.opts.samples_format}"
,
"metadata"
:
checkpoint
.
metadata
,
"sort_keys"
:
{
'default'
:
index
,
**
self
.
get_sort_keys
(
checkpoint
.
filename
)},
}
...
...
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