additional memory improvements when switching between models of different types

This commit is contained in:
AUTOMATIC1111 2023-07-31 10:43:31 +03:00
parent 29d7e31d89
commit 4d9b096663
1 changed files with 4 additions and 1 deletions

View File

@ -582,7 +582,10 @@ def reload_model_weights(sd_model=None, info=None):
timer.record("find config")
if sd_model is None or checkpoint_config != sd_model.used_config:
del sd_model
if sd_model is not None:
sd_model.to(device="meta")
devices.torch_gc()
load_model(checkpoint_info, already_loaded_state_dict=state_dict)
return model_data.sd_model