From c6465d350abd4e25f34b6c054595645941f047b5 Mon Sep 17 00:00:00 2001 From: Huang Yue <1431039261@qq.com> Date: Mon, 22 Apr 2024 00:08:23 +0800 Subject: [PATCH] update --- trustllm_pkg/trustllm/utils/metrics.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/trustllm_pkg/trustllm/utils/metrics.py b/trustllm_pkg/trustllm/utils/metrics.py index a1d4e63..d57945f 100644 --- a/trustllm_pkg/trustllm/utils/metrics.py +++ b/trustllm_pkg/trustllm/utils/metrics.py @@ -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):