aboutsummaryrefslogtreecommitdiffstats
path: root/modules/hypernetwork/ui.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-10-11 12:51:22 +0000
committerAUTOMATIC <16777216c@gmail.com>2022-10-11 12:51:30 +0000
commit873efeed49bb5197a42da18272115b326c5d68f3 (patch)
tree519f2766d84d67b46230f48e862c9ee28d9d9e03 /modules/hypernetwork/ui.py
parenta004d1a855311b0d7ff2976a4e31b0247ad9d1f6 (diff)
downloadstable-diffusion-webui-gfx803-873efeed49bb5197a42da18272115b326c5d68f3.tar.gz
stable-diffusion-webui-gfx803-873efeed49bb5197a42da18272115b326c5d68f3.tar.bz2
stable-diffusion-webui-gfx803-873efeed49bb5197a42da18272115b326c5d68f3.zip
rename hypernetwork dir to hypernetworks to prevent clash with an old filename that people who use zip instead of git clone will have
Diffstat (limited to 'modules/hypernetwork/ui.py')
-rw-r--r--modules/hypernetwork/ui.py43
1 files changed, 0 insertions, 43 deletions
diff --git a/modules/hypernetwork/ui.py b/modules/hypernetwork/ui.py
deleted file mode 100644
index f6d1d0a3..00000000
--- a/modules/hypernetwork/ui.py
+++ /dev/null
@@ -1,43 +0,0 @@
-import html
-import os
-
-import gradio as gr
-
-import modules.textual_inversion.textual_inversion
-import modules.textual_inversion.preprocess
-from modules import sd_hijack, shared
-from modules.hypernetwork import hypernetwork
-
-
-def create_hypernetwork(name):
- fn = os.path.join(shared.cmd_opts.hypernetwork_dir, f"{name}.pt")
- assert not os.path.exists(fn), f"file {fn} already exists"
-
- hypernet = modules.hypernetwork.hypernetwork.Hypernetwork(name=name)
- hypernet.save(fn)
-
- shared.reload_hypernetworks()
-
- return gr.Dropdown.update(choices=sorted([x for x in shared.hypernetworks.keys()])), f"Created: {fn}", ""
-
-
-def train_hypernetwork(*args):
-
- initial_hypernetwork = shared.loaded_hypernetwork
-
- try:
- sd_hijack.undo_optimizations()
-
- hypernetwork, filename = modules.hypernetwork.hypernetwork.train_hypernetwork(*args)
-
- res = f"""
-Training {'interrupted' if shared.state.interrupted else 'finished'} at {hypernetwork.step} steps.
-Hypernetwork saved to {html.escape(filename)}
-"""
- return res, ""
- except Exception:
- raise
- finally:
- shared.loaded_hypernetwork = initial_hypernetwork
- sd_hijack.apply_optimizations()
-