mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-02-22 14:15:06 +08:00
additional memory improvements when switching between models of different types
This commit is contained in:
parent
29d7e31d89
commit
4d9b096663
@ -582,7 +582,10 @@ def reload_model_weights(sd_model=None, info=None):
|
|||||||
timer.record("find config")
|
timer.record("find config")
|
||||||
|
|
||||||
if sd_model is None or checkpoint_config != sd_model.used_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)
|
load_model(checkpoint_info, already_loaded_state_dict=state_dict)
|
||||||
return model_data.sd_model
|
return model_data.sd_model
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user