Skip to content

Commit

Permalink
Avoid divide by zero error (#458)
Browse files Browse the repository at this point in the history
  • Loading branch information
erickgalinkin committed Feb 8, 2024
1 parent b8a503c commit 0495d11
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion garak/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def get_evaluations(self):

evals_df = pd.DataFrame.from_dict(evals)
self.evaluations = evals_df.assign(
score=lambda x: (x["passed"] / x["total"] * 100)
score=lambda x: (x["passed"] / x["total"] * 100) if x["total"] > 0 else 0
)
self.scores = self.evaluations[["probe", "score"]].groupby("probe").mean()
return self
Expand Down

0 comments on commit 0495d11

Please sign in to comment.