Commit ca87c09c authored by d8ahazard's avatar d8ahazard

Fix recursive model loading

Ensure we find checkpoints within subdirectories.
parent 19eb1467
import glob
import os
import shutil
import importlib
......@@ -41,7 +42,7 @@ def load_models(model_path: str, model_url: str = None, command_path: str = None
for place in places:
if os.path.exists(place):
for file in os.listdir(place):
for file in glob.iglob(place + '**/**', recursive=True):
full_path = os.path.join(place, file)
if os.path.isdir(full_path):
continue
......@@ -50,6 +51,7 @@ def load_models(model_path: str, model_url: str = None, command_path: str = None
if extension not in ext_filter:
continue
if file not in output:
print(f"FILE: {full_path}")
output.append(full_path)
if model_url is not None and len(output) == 0:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment