Commit 27ead750 authored by Bruce MacDonald's avatar Bruce MacDonald
Browse files

try next runner if load fails

parent a86a4f8c
...@@ -39,12 +39,18 @@ def load(model_name, models={}): ...@@ -39,12 +39,18 @@ def load(model_name, models={}):
for model_type in cls.model_types() for model_type in cls.model_types()
} }
best_match, _ = process.extractOne(model_path, runners.keys()) while len(runners) > 0:
model = runners.get(best_match, LlamaCppRunner) try:
best_match, _ = process.extractOne(model_path, runners.keys())
models.update({model_name: model(model_path, best_match)}) model = runners.get(best_match, LlamaCppRunner)
runner = model(model_path, best_match)
return models.get(model_name) models.update({model_name: runner})
return models.get(model_name)
except Exception:
# try the next runner
runners.pop(best_match)
raise Exception("failed to load model", model_path, model_name)
def unload(model_name, models={}): def unload(model_name, models={}):
......
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