Sort straight out of the glob

This commit is contained in:
Isaac Poulton 2022-11-04 20:53:11 +07:00 committed by GitHub
parent fd62727893
commit 08feb4c364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -219,12 +219,12 @@ class Hypernetwork:
def list_hypernetworks(path):
res = {}
for filename in glob.iglob(os.path.join(path, '**/*.pt'), recursive=True):
for filename in sorted(glob.iglob(os.path.join(path, '**/*.pt'), recursive=True)):
name = os.path.splitext(os.path.basename(filename))[0]
# Prevent a hypothetical "None.pt" from being listed.
if name != "None":
res[name] = filename
return dict(sorted(res.items()))
return res
def load_hypernetwork(filename):