aboutsummaryrefslogtreecommitdiffstats
path: root/modules/hypernetworks/ui.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-10-11 16:03:08 +0000
committerAUTOMATIC <16777216c@gmail.com>2022-10-11 16:03:08 +0000
commitd4ea5f4d8631f778d11efcde397e4a5b8801d43b (patch)
treee3adec63b48acb860f8149edb588421a8c2fe6ba /modules/hypernetworks/ui.py
parent6d09b8d1df3a96e1380bb1650f5961781630af96 (diff)
downloadstable-diffusion-webui-gfx803-d4ea5f4d8631f778d11efcde397e4a5b8801d43b.tar.gz
stable-diffusion-webui-gfx803-d4ea5f4d8631f778d11efcde397e4a5b8801d43b.tar.bz2
stable-diffusion-webui-gfx803-d4ea5f4d8631f778d11efcde397e4a5b8801d43b.zip
add an option to unload models during hypernetwork training to save VRAM
Diffstat (limited to 'modules/hypernetworks/ui.py')
-rw-r--r--modules/hypernetworks/ui.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/hypernetworks/ui.py b/modules/hypernetworks/ui.py
index 3541a388..c67facbb 100644
--- a/modules/hypernetworks/ui.py
+++ b/modules/hypernetworks/ui.py
@@ -5,7 +5,7 @@ import gradio as gr
import modules.textual_inversion.textual_inversion
import modules.textual_inversion.preprocess
-from modules import sd_hijack, shared
+from modules import sd_hijack, shared, devices
from modules.hypernetworks import hypernetwork
@@ -41,5 +41,7 @@ Hypernetwork saved to {html.escape(filename)}
raise
finally:
shared.loaded_hypernetwork = initial_hypernetwork
+ shared.sd_model.cond_stage_model.to(devices.device)
+ shared.sd_model.first_stage_model.to(devices.device)
sd_hijack.apply_optimizations()