Merge pull request #46 from ArdalanM/patch-1
fix cases when some categories are empty
This commit is contained in:
@@ -359,7 +359,7 @@ def process_predictions(input_path, output_path):
|
|||||||
total_len += 1
|
total_len += 1
|
||||||
mean_score += item["score"]
|
mean_score += item["score"]
|
||||||
|
|
||||||
mean_score = mean_score / total_len
|
mean_score = mean_score / total_len if total_len > 0 else 0
|
||||||
print(f"Task {task_name}, total instructions: {total_len}, average score: {mean_score:.3f}\n")
|
print(f"Task {task_name}, total instructions: {total_len}, average score: {mean_score:.3f}\n")
|
||||||
|
|
||||||
with open(output_path, 'w', encoding='utf-8') as file:
|
with open(output_path, 'w', encoding='utf-8') as file:
|
||||||
|
Reference in New Issue
Block a user