Skip to content

Commit

Permalink
add gsm evaluator
Browse files Browse the repository at this point in the history
  • Loading branch information
shuishen112 committed Dec 24, 2024
1 parent 5b541a0 commit 3036dd6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mttl/evaluators/gsm_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ def print_python_code(predictions_texts, batch, file):
print_python_code(predictions_texts, batch, f)
else:
raise ValueError("Invalid templete")

metrics = self.compute_metrics(all_predictions, all_targets)
return metrics
if len(all_predictions) != 0:
metrics = self.compute_metrics(all_predictions, all_targets)
return metrics
else:
raise ValueError("No predictions found")

def compute_metrics(self, predictions, targets):
# compute the accuracy based on the cot prompt
Expand Down

0 comments on commit 3036dd6

Please sign in to comment.