diff options
author | discus0434 <discus0434@gmail.com> | 2022-10-19 15:28:42 +0000 |
---|---|---|
committer | discus0434 <discus0434@gmail.com> | 2022-10-19 15:28:42 +0000 |
commit | 3770b8d2fa62066d472a04739c7b84bce8538832 (patch) | |
tree | b4dd5184fc85bd30e21ae4c6afff9bf4f526c93c /modules/hypernetworks/ui.py | |
parent | 42fbda83bb9830af18187fddb50c1bedd01da502 (diff) | |
download | stable-diffusion-webui-gfx803-3770b8d2fa62066d472a04739c7b84bce8538832.tar.gz stable-diffusion-webui-gfx803-3770b8d2fa62066d472a04739c7b84bce8538832.tar.bz2 stable-diffusion-webui-gfx803-3770b8d2fa62066d472a04739c7b84bce8538832.zip |
enable to write layer structure of hn himself
Diffstat (limited to 'modules/hypernetworks/ui.py')
-rw-r--r-- | modules/hypernetworks/ui.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/hypernetworks/ui.py b/modules/hypernetworks/ui.py index 7e8ea95e..08f75f15 100644 --- a/modules/hypernetworks/ui.py +++ b/modules/hypernetworks/ui.py @@ -1,5 +1,6 @@ import html
import os
+import re
import gradio as gr
@@ -13,6 +14,9 @@ def create_hypernetwork(name, enable_sizes, layer_structure=None, add_layer_norm fn = os.path.join(shared.cmd_opts.hypernetwork_dir, f"{name}.pt")
assert not os.path.exists(fn), f"file {fn} already exists"
+ if type(layer_structure) == str:
+ layer_structure = tuple(map(int, re.sub(r'\D', '', layer_structure)))
+
hypernet = modules.hypernetworks.hypernetwork.Hypernetwork(
name=name,
enable_sizes=[int(x) for x in enable_sizes],
|