From 317e6f9b6c40e883eee4f77076e7189227c9f8c9 Mon Sep 17 00:00:00 2001 From: zappityzap Date: Sat, 2 Nov 2024 11:14:10 -0700 Subject: [PATCH] exclude .modelfile extension --- modules/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/utils.py b/modules/utils.py index 6e33b460..c4a30950 100644 --- a/modules/utils.py +++ b/modules/utils.py @@ -73,12 +73,13 @@ def natural_keys(text): def get_available_models(): + exclude_extensions = ('.txt', '-np', '.pt', '.json', '.yaml', '.py', '.modelfile') model_list = [] for dirpath, dirnames, files in os.walk(shared.args.model_dir, followlinks=True): for file in files: file_path = os.path.join(dirpath, file) relative_path = os.path.relpath(file_path, shared.args.model_dir) - if not file.endswith(('.txt', '-np', '.pt', '.json', '.yaml', '.py')) and 'llama-tokenizer' not in relative_path: + if not file.endswith(exclude_extensions) and 'llama-tokenizer' not in relative_path: model_list.append(relative_path) return ['None'] + sorted(model_list, key=natural_keys)