Merge pull request #1147 from Disty0/master

Send to CPU intead of XPU when unloading
This commit is contained in:
Vladimir Mandic
2023-05-24 08:18:31 -04:00
committed by GitHub
+6 -1
View File
@@ -465,6 +465,8 @@ def reload_model_weights(sd_model=None, info=None):
return
if shared.cmd_opts.lowvram or shared.cmd_opts.medvram:
lowvram.send_everything_to_cpu()
elif shared.cmd_opts.use_ipex:
sd_model.to("cpu")
else:
sd_model.to(devices.cpu)
sd_hijack.model_hijack.undo_hijack(sd_model)
@@ -501,7 +503,10 @@ def reload_model_weights(sd_model=None, info=None):
def unload_model_weights(sd_model=None, _info=None):
from modules import sd_hijack
if model_data.sd_model:
model_data.sd_model.to(devices.cpu)
if shared.cmd_opts.use_ipex:
model_data.sd_model.to("cpu")
else:
model_data.sd_model.to(devices.cpu)
sd_hijack.model_hijack.undo_hijack(model_data.sd_model)
model_data.sd_model = None
sd_model = None