aboutsummaryrefslogtreecommitdiffstats
path: root/modules/sd_models.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-10-15 06:41:02 +0000
committerAUTOMATIC1111 <16777216c@gmail.com>2023-10-15 06:41:02 +0000
commit282903bb6798f49af66f6935ee4dc0015895cf7c (patch)
treec6bb9c1d4f298fe7c3b8d797cd7491fa873badf0 /modules/sd_models.py
parent0d65d0eabded4a79c3168ed14599db3970d414c5 (diff)
downloadstable-diffusion-webui-gfx803-282903bb6798f49af66f6935ee4dc0015895cf7c.tar.gz
stable-diffusion-webui-gfx803-282903bb6798f49af66f6935ee4dc0015895cf7c.tar.bz2
stable-diffusion-webui-gfx803-282903bb6798f49af66f6935ee4dc0015895cf7c.zip
repair unload sd checkpoint button
Diffstat (limited to 'modules/sd_models.py')
-rw-r--r--modules/sd_models.py13
1 files changed, 1 insertions, 12 deletions
diff --git a/modules/sd_models.py b/modules/sd_models.py
index c8efeedc..3b6cdea1 100644
--- a/modules/sd_models.py
+++ b/modules/sd_models.py
@@ -1,7 +1,6 @@
import collections
import os.path
import sys
-import gc
import threading
import torch
@@ -798,17 +797,7 @@ def reload_model_weights(sd_model=None, info=None):
def unload_model_weights(sd_model=None, info=None):
- timer = Timer()
-
- if model_data.sd_model:
- 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
- gc.collect()
- devices.torch_gc()
-
- print(f"Unloaded weights {timer.summary()}.")
+ send_model_to_cpu(sd_model or shared.sd_model)
return sd_model