File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,6 +22,23 @@ def __init__(self, path) -> None:
2222 self .message = f"Model could not be found at { path } "
2323
2424
25+ class InvalidModelError (EvalError ):
26+ """
27+ Error raised when model can be found but is invalid
28+
29+ Attributes
30+ message error message to be printed on raise
31+ path filepath of model location
32+ reason root cause for model invalidity
33+ """
34+
35+ def __init__ (self , path , reason ) -> None :
36+ super ().__init__ ()
37+ self .path = path
38+ self .reason = reason
39+ self .message = f"Model found at { path } but was invalid due to: { reason } "
40+
41+
2542class InvalidGitRepoError (EvalError ):
2643 """
2744 Error raised when taxonomy dir provided isn't a valid git repo
Original file line number Diff line number Diff line change 1212# First Party
1313from instructlab .eval .evaluator import Evaluator
1414from instructlab .eval .exceptions import (
15+ InvalidModelError ,
1516 InvalidTasksDirError ,
1617 ModelNotFoundError ,
1718 TasksDirNotFoundError ,
@@ -158,6 +159,9 @@ def _simple_evaluate_with_error_handling(self, **kwargs):
158159 ose
159160 ) or "does not appear to have a file named" in str (ose ):
160161 raise ModelNotFoundError (self .model_path ) from ose
162+ if "is not a valid JSON file" in str (ose ):
163+ reason = "Looked for valid JSON file but couldn't find one - are you pointing at a directory with a 'config.json'?"
164+ raise InvalidModelError (self .model_path , reason ) from ose
161165 raise
162166
163167
You can’t perform that action at this time.
0 commit comments