Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error handling for empty node_results to base.py. #942

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions garak/probes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,10 @@ def probe(self, generator):
node_results = [
1.0 if s > self.per_generation_threshold else 0 for s in node_results
]

mean_score = sum(node_results) / len(node_results)
if len(node_results) > 0:
mean_score = sum(node_results) / len(node_results)
else:
mean_score = 0
parent = self._get_node_parent(current_node)
node_info = {
"entry_type": "tree_data",
Expand Down
Loading