From 9849aac0f1284c5fa02509f1e197cc248e2c4700 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Thu, 9 Mar 2023 21:54:50 -0300 Subject: [PATCH] Don't show .pt models in the list --- modules/models.py | 3 +++ server.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/models.py b/modules/models.py index 0ad4c198..3e6cea18 100644 --- a/modules/models.py +++ b/modules/models.py @@ -105,6 +105,9 @@ def load_model(model_name): if not Path(f"models/{pt_model}").exists(): print(f"Could not find models/{pt_model}, exiting...") exit() + elif pt_model == '': + print(f"Could not find the .pt model for {model_name}, exiting...") + exit() model = load_quant(path_to_model, Path(f"models/{pt_model}"), 4) model = model.to(torch.device('cuda:0')) diff --git a/server.py b/server.py index 7d8792b7..c2977f41 100644 --- a/server.py +++ b/server.py @@ -37,7 +37,7 @@ def get_available_models(): if shared.args.flexgen: return sorted([re.sub('-np$', '', item.name) for item in list(Path('models/').glob('*')) if item.name.endswith('-np')], key=str.lower) else: - return sorted([item.name for item in list(Path('models/').glob('*')) if not item.name.endswith(('.txt', '-np'))], key=str.lower) + return sorted([item.name for item in list(Path('models/').glob('*')) if not item.name.endswith(('.txt', '-np', '.pt'))], key=str.lower) def get_available_presets(): return sorted(set(map(lambda x : '.'.join(str(x.name).split('.')[:-1]), Path('presets').glob('*.txt'))), key=str.lower)