From d1f098540ad1dbc2abb8d04322634efba650b631 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Fri, 30 Sep 2022 11:42:40 +0300 Subject: remove unwanted formatting/functionality from the PR --- modules/modelloader.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'modules/modelloader.py') diff --git a/modules/modelloader.py b/modules/modelloader.py index b3e6dc36..1106aeb7 100644 --- a/modules/modelloader.py +++ b/modules/modelloader.py @@ -25,8 +25,10 @@ def load_models(model_path: str, model_url: str = None, command_path: str = None if ext_filter is None: ext_filter = [] + try: places = [] + if command_path is not None and command_path != model_path: pretrained_path = os.path.join(command_path, 'experiments/pretrained_models') if os.path.exists(pretrained_path): @@ -34,7 +36,9 @@ def load_models(model_path: str, model_url: str = None, command_path: str = None places.append(pretrained_path) elif os.path.exists(command_path): places.append(command_path) + places.append(model_path) + for place in places: if os.path.exists(place): for file in os.listdir(place): @@ -47,14 +51,17 @@ def load_models(model_path: str, model_url: str = None, command_path: str = None continue if file not in output: output.append(full_path) + if model_url is not None and len(output) == 0: if download_name is not None: dl = load_file_from_url(model_url, model_path, True, download_name) output.append(dl) else: output.append(model_url) - except: + + except Exception: pass + return output -- cgit v1.2.3