From 0619df9835833079f8ba5cb5a510b55c4433acaf Mon Sep 17 00:00:00 2001 From: AUTOMATIC1111 <16777216c@gmail.com> Date: Sat, 14 Oct 2023 08:01:04 +0300 Subject: [PATCH] use shallow copy for #13535 --- modules/sd_models.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/sd_models.py b/modules/sd_models.py index 2b43868e9..c8efeedca 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -1,5 +1,4 @@ import collections -import copy import os.path import sys import gc @@ -360,7 +359,7 @@ def load_model_weights(model, checkpoint_info: CheckpointInfo, state_dict, timer if shared.opts.sd_checkpoint_cache > 0: # cache newly loaded model - checkpoints_loaded[checkpoint_info] = copy.deepcopy(state_dict) + checkpoints_loaded[checkpoint_info] = state_dict.copy() model.load_state_dict(state_dict, strict=False) timer.record("apply weights to model")