Commit 55ab5e60 authored by Bruce MacDonald's avatar Bruce MacDonald
Browse files

return an error when the model cant be loaded

parent e4bdacb1
...@@ -45,11 +45,14 @@ def load(model, models_home=".", llms={}): ...@@ -45,11 +45,14 @@ def load(model, models_home=".", llms={}):
# try loading this as a path to a model, rather than a model name # try loading this as a path to a model, rather than a model name
model_path = os.path.abspath(model) model_path = os.path.abspath(model)
# suppress LLM's output try:
with suppress_stderr(): # suppress LLM's output
llm = LLM(model_path, verbose=False) with suppress_stderr():
llms.update({model: llm}) llm = LLM(model_path, verbose=False)
llms.update({model: llm})
except Exception as e:
# e is sent to devnull, so create a generic exception
raise Exception(f"Failed to load model: {model}")
return llm return llm
......
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