fix rouge score

This commit is contained in:
hiyouga 2023-07-06 14:28:34 +08:00
parent 89c623e4bf
commit caa00d3ac2
1 changed files with 1 additions and 1 deletions

View File

@ -46,7 +46,7 @@ class ComputeMetrics:
hypothesis = list(jieba.cut(pred))
reference = list(jieba.cut(label))
if len(" ".join(hypothesis).split()) == 0:
if len(" ".join(hypothesis).split()) == 0 or len(" ".join(reference).split()) == 0:
result = {"rouge-1": {"f": 0.0}, "rouge-2": {"f": 0.0}, "rouge-l": {"f": 0.0}}
else:
rouge = Rouge()