Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: checkpoints_loaded:{checkpoint:state_dict}, model.load_state_dict issue in dict value empty #13535

Merged
merged 2 commits into from
Oct 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions modules/sd_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import collections
import copy
import os.path
import sys
import gc
Expand Down Expand Up @@ -352,12 +353,12 @@ def load_model_weights(model, checkpoint_info: CheckpointInfo, state_dict, timer
if model.is_sdxl:
sd_models_xl.extend_sdxl(model)

model.load_state_dict(state_dict, strict=False)
timer.record("apply weights to model")

if shared.opts.sd_checkpoint_cache > 0:
# cache newly loaded model
checkpoints_loaded[checkpoint_info] = state_dict
checkpoints_loaded[checkpoint_info] = copy.deepcopy(state_dict)

model.load_state_dict(state_dict, strict=False)
timer.record("apply weights to model")

del state_dict

Expand Down