Skip to content

Commit

Permalink
use shallow copy for AUTOMATIC1111#13535
Browse files Browse the repository at this point in the history
  • Loading branch information
AUTOMATIC1111 authored and ruchej committed Sep 30, 2024
1 parent b86c124 commit bc43e16
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions modules/sd_models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import collections
import copy
import os.path
import sys
import gc
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit bc43e16

Please sign in to comment.