Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongping-Chen committed Apr 21, 2024
2 parents ce56e34 + c6465d3 commit 62f9d6d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion trustllm_pkg/trustllm/utils/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ def calculate_toxicity(data, key='toxicity'):
average = sum(values) / len(values)
maximum = max(values)

return average, maximum
return {
"average_toxicity": average,
"max_toxicity": maximum
}


def is_chinese_ratio(text, ratio):
Expand Down

0 comments on commit 62f9d6d

Please sign in to comment.