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
2c5ca706
Commit
2c5ca706
authored
Nov 13, 2022
by
Muhammad Rizqi Nur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove no longer necessary parts and add vae_file safeguard
parent
e5690d0b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
8 deletions
+3
-8
modules/sd_models.py
modules/sd_models.py
+2
-8
modules/sd_vae.py
modules/sd_vae.py
+1
-0
No files found.
modules/sd_models.py
View file @
2c5ca706
...
@@ -165,16 +165,9 @@ def load_model_weights(model, checkpoint_info, vae_file="auto"):
...
@@ -165,16 +165,9 @@ def load_model_weights(model, checkpoint_info, vae_file="auto"):
cache_enabled
=
shared
.
opts
.
sd_checkpoint_cache
>
0
cache_enabled
=
shared
.
opts
.
sd_checkpoint_cache
>
0
if
cache_enabled
:
sd_vae
.
restore_base_vae
(
model
)
vae_file
=
sd_vae
.
resolve_vae
(
checkpoint_file
,
vae_file
=
vae_file
)
if
cache_enabled
and
checkpoint_info
in
checkpoints_loaded
:
if
cache_enabled
and
checkpoint_info
in
checkpoints_loaded
:
# use checkpoint cache
# use checkpoint cache
vae_name
=
sd_vae
.
get_filename
(
vae_file
)
if
vae_file
else
None
print
(
f
"Loading weights [{sd_model_hash}] from cache"
)
vae_message
=
f
" with {vae_name} VAE"
if
vae_name
else
""
print
(
f
"Loading weights [{sd_model_hash}]{vae_message} from cache"
)
model
.
load_state_dict
(
checkpoints_loaded
[
checkpoint_info
])
model
.
load_state_dict
(
checkpoints_loaded
[
checkpoint_info
])
else
:
else
:
# load from file
# load from file
...
@@ -220,6 +213,7 @@ def load_model_weights(model, checkpoint_info, vae_file="auto"):
...
@@ -220,6 +213,7 @@ def load_model_weights(model, checkpoint_info, vae_file="auto"):
model
.
sd_model_checkpoint
=
checkpoint_file
model
.
sd_model_checkpoint
=
checkpoint_file
model
.
sd_checkpoint_info
=
checkpoint_info
model
.
sd_checkpoint_info
=
checkpoint_info
vae_file
=
sd_vae
.
resolve_vae
(
checkpoint_file
,
vae_file
=
vae_file
)
sd_vae
.
load_vae
(
model
,
vae_file
)
sd_vae
.
load_vae
(
model
,
vae_file
)
...
...
modules/sd_vae.py
View file @
2c5ca706
...
@@ -139,6 +139,7 @@ def load_vae(model, vae_file=None):
...
@@ -139,6 +139,7 @@ def load_vae(model, vae_file=None):
# save_settings = False
# save_settings = False
if
vae_file
:
if
vae_file
:
assert
os
.
path
.
isfile
(
vae_file
),
f
"VAE file doesn't exist: {vae_file}"
print
(
f
"Loading VAE weights from: {vae_file}"
)
print
(
f
"Loading VAE weights from: {vae_file}"
)
vae_ckpt
=
torch
.
load
(
vae_file
,
map_location
=
shared
.
weight_load_location
)
vae_ckpt
=
torch
.
load
(
vae_file
,
map_location
=
shared
.
weight_load_location
)
vae_dict_1
=
{
k
:
v
for
k
,
v
in
vae_ckpt
[
"state_dict"
]
.
items
()
if
k
[
0
:
4
]
!=
"loss"
and
k
not
in
vae_ignore_keys
}
vae_dict_1
=
{
k
:
v
for
k
,
v
in
vae_ckpt
[
"state_dict"
]
.
items
()
if
k
[
0
:
4
]
!=
"loss"
and
k
not
in
vae_ignore_keys
}
...
...
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