return an error when the model cant be loaded
This commit is contained in:
parent
e4bdacb152
commit
55ab5e60db
1 changed files with 8 additions and 5 deletions
|
@ -45,11 +45,14 @@ def load(model, models_home=".", llms={}):
|
|||
# try loading this as a path to a model, rather than a model name
|
||||
model_path = os.path.abspath(model)
|
||||
|
||||
try:
|
||||
# suppress LLM's output
|
||||
with suppress_stderr():
|
||||
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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue