diff options
author | timntorres <timothynarcisotorres@gmail.com> | 2022-10-28 08:41:57 +0000 |
---|---|---|
committer | timntorres <timothynarcisotorres@gmail.com> | 2022-10-28 08:41:57 +0000 |
commit | db5a354c489bfd1c95e0bbf9af12ab8b5d6fe170 (patch) | |
tree | f279bc49a050ecde2538f1a84c15717395f39d82 | |
parent | c0677b33161f04c3ed1a7a78f4c7288fb95787b7 (diff) | |
download | stable-diffusion-webui-gfx803-db5a354c489bfd1c95e0bbf9af12ab8b5d6fe170.tar.gz stable-diffusion-webui-gfx803-db5a354c489bfd1c95e0bbf9af12ab8b5d6fe170.tar.bz2 stable-diffusion-webui-gfx803-db5a354c489bfd1c95e0bbf9af12ab8b5d6fe170.zip |
Always ignore "None.pt" in the hypernet directory.
-rw-r--r-- | modules/hypernetworks/hypernetwork.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/hypernetworks/hypernetwork.py b/modules/hypernetworks/hypernetwork.py index 8113b35b..cd920df5 100644 --- a/modules/hypernetworks/hypernetwork.py +++ b/modules/hypernetworks/hypernetwork.py @@ -208,13 +208,16 @@ def list_hypernetworks(path): res = {}
for filename in glob.iglob(os.path.join(path, '**/*.pt'), recursive=True):
name = os.path.splitext(os.path.basename(filename))[0]
- res[name] = filename
+ # Prevent a hypothetical "None.pt" from being listed.
+ if name != "None":
+ res[name] = filename
return res
def load_hypernetwork(filename):
path = shared.hypernetworks.get(filename, None)
- if path is not None:
+ # Prevent any file named "None.pt" from being loaded.
+ if path is not None and filename != "None":
print(f"Loading hypernetwork {filename}")
try:
shared.loaded_hypernetwork = Hypernetwork()
|