diff options
author | papuSpartan <30642826+papuSpartan@users.noreply.github.com> | 2022-10-21 18:53:32 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-21 18:53:32 +0000 |
commit | 4a9ff0891abc413031b44926372f611513b4810f (patch) | |
tree | f7622454a45669b13bce691e312f2c9dcfd9fb8a /modules/hypernetworks/ui.py | |
parent | a3b047b7c74dc6ca07f40aee778997fc1889d72f (diff) | |
parent | f49c08ea566385db339c6628f65c3a121033f67c (diff) | |
download | stable-diffusion-webui-gfx803-4a9ff0891abc413031b44926372f611513b4810f.tar.gz stable-diffusion-webui-gfx803-4a9ff0891abc413031b44926372f611513b4810f.tar.bz2 stable-diffusion-webui-gfx803-4a9ff0891abc413031b44926372f611513b4810f.zip |
Merge branch 'AUTOMATIC1111:master' into master
Diffstat (limited to 'modules/hypernetworks/ui.py')
-rw-r--r-- | modules/hypernetworks/ui.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/hypernetworks/ui.py b/modules/hypernetworks/ui.py index e0741d08..e6f50a1f 100644 --- a/modules/hypernetworks/ui.py +++ b/modules/hypernetworks/ui.py @@ -10,9 +10,13 @@ from modules import sd_hijack, shared, devices from modules.hypernetworks import hypernetwork
-def create_hypernetwork(name, enable_sizes, layer_structure=None, add_layer_norm=False):
+def create_hypernetwork(name, enable_sizes, overwrite_old, layer_structure=None, add_layer_norm=False, activation_func=None):
+ # Remove illegal characters from name.
+ name = "".join( x for x in name if (x.isalnum() or x in "._- "))
+
fn = os.path.join(shared.cmd_opts.hypernetwork_dir, f"{name}.pt")
- assert not os.path.exists(fn), f"file {fn} already exists"
+ if not overwrite_old:
+ assert not os.path.exists(fn), f"file {fn} already exists"
if type(layer_structure) == str:
layer_structure = [float(x.strip()) for x in layer_structure.split(",")]
@@ -22,6 +26,7 @@ def create_hypernetwork(name, enable_sizes, layer_structure=None, add_layer_norm enable_sizes=[int(x) for x in enable_sizes],
layer_structure=layer_structure,
add_layer_norm=add_layer_norm,
+ activation_func=activation_func,
)
hypernet.save(fn)
|