fix: eval_method cannot catch run factor error (#260)

* Update eval_method.py

abort subsequent evaluators for invalid gen_df

* add AttributeError

* add raise_exception for eval_method

* remove custom exception catch
This commit is contained in:
Tim
2024-09-14 17:47:27 +08:00
committed by GitHub
parent ebb2a3cf75
commit a4d5a2d66a
2 changed files with 2 additions and 3 deletions
+1 -1
View File
@@ -104,7 +104,7 @@ class BaseEval:
try:
eval_res.append((ev, ev.evaluate(implementation=case_gen, gt_implementation=case_gt)))
# if the corr ev is successfully evaluated and achieve the best performance, then break
except CoderError as e:
except (CoderError, AttributeError) as e:
return e
except Exception as e:
# exception when evaluation
@@ -55,10 +55,9 @@ class FactorTestCaseLoaderFromJsonFile:
factor_formulation=factor_data["formulation"],
variables=factor_data["variables"],
)
gt = FactorFBWorkspace(task)
gt = FactorFBWorkspace(task, raise_exception=True)
code = {"factor.py": factor_data["gt_code"]}
gt.inject_code(**code)
gt.execute()
TestData.target_task.sub_tasks.append(task)
TestData.ground_truth.append(gt)