Commit 0619df98 authored by AUTOMATIC1111's avatar AUTOMATIC1111
Browse files

use shallow copy for #13535

parent 7cc96429
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
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")