Skip to content

Commit

Permalink
Merge pull request #13535 from chu8129/dev
Browse files Browse the repository at this point in the history
fix: checkpoints_loaded:{checkpoint:state_dict}, model.load_state_dict issue in dict value empty
  • Loading branch information
AUTOMATIC1111 authored Oct 14, 2023
2 parents 26500b8 + 770ee23 commit 7cc9642
Showing 1 changed file with 5 additions and 4 deletions.
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 @@ -357,12 +358,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

0 comments on commit 7cc9642

Please sign in to comment.