restore #4035 behavior

- if checkpoint cache is set to 1, keep 2 models in cache (current +1 more)
This commit is contained in:
cluder 2022-11-09 07:17:09 +01:00
parent f37cce0e3d
commit eebf49592a

View file

@ -213,7 +213,7 @@ def load_model_weights(model, checkpoint_info, vae_file="auto"):
# clean up cache if limit is reached
if cache_enabled:
while len(checkpoints_loaded) > shared.opts.sd_checkpoint_cache:
while len(checkpoints_loaded) > shared.opts.sd_checkpoint_cache + 1: # we need to count the current model
checkpoints_loaded.popitem(last=False) # LRU
model.sd_model_hash = sd_model_hash