Always ignore "None.pt" in the hypernet directory.
This commit is contained in:
parent
c0677b3316
commit
db5a354c48
1 changed files with 5 additions and 2 deletions
|
@ -208,13 +208,16 @@ def list_hypernetworks(path):
|
||||||
res = {}
|
res = {}
|
||||||
for filename in glob.iglob(os.path.join(path, '**/*.pt'), recursive=True):
|
for filename in glob.iglob(os.path.join(path, '**/*.pt'), recursive=True):
|
||||||
name = os.path.splitext(os.path.basename(filename))[0]
|
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
|
return res
|
||||||
|
|
||||||
|
|
||||||
def load_hypernetwork(filename):
|
def load_hypernetwork(filename):
|
||||||
path = shared.hypernetworks.get(filename, None)
|
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}")
|
print(f"Loading hypernetwork {filename}")
|
||||||
try:
|
try:
|
||||||
shared.loaded_hypernetwork = Hypernetwork()
|
shared.loaded_hypernetwork = Hypernetwork()
|
||||||
|
|
Loading…
Reference in a new issue