diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-10-14 05:00:04 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-14 05:00:04 +0000 |
commit | 7cc96429f2f779b2e43804e0c987932cf4c0dd48 (patch) | |
tree | 745ce7e175259d11a7646ef33baf56ba2404c362 | |
parent | 26500b8c1bd0986882afb0f7e5cbc556b87a782d (diff) | |
parent | 770ee23f18d12fb3b5627c636aa420f481e292ee (diff) | |
download | stable-diffusion-webui-gfx803-7cc96429f2f779b2e43804e0c987932cf4c0dd48.tar.gz stable-diffusion-webui-gfx803-7cc96429f2f779b2e43804e0c987932cf4c0dd48.tar.bz2 stable-diffusion-webui-gfx803-7cc96429f2f779b2e43804e0c987932cf4c0dd48.zip |
Merge pull request #13535 from chu8129/dev
fix: checkpoints_loaded:{checkpoint:state_dict}, model.load_state_dict issue in dict value empty
-rw-r--r-- | modules/sd_models.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/sd_models.py b/modules/sd_models.py index 7f8502f5..2b43868e 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -1,4 +1,5 @@ import collections
+import copy
import os.path
import sys
import gc
@@ -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
|