From 98242ff1d1387e941154a2b7af8ca88c7ebb8e34 Mon Sep 17 00:00:00 2001 From: Linchen Xiao Date: Mon, 18 Nov 2024 20:14:29 +0800 Subject: [PATCH] [Update] first_option_postprocess (#1699) * update first_option_postprocess * update --- opencompass/utils/text_postprocessors.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opencompass/utils/text_postprocessors.py b/opencompass/utils/text_postprocessors.py index 367fcbd1..16083a0b 100644 --- a/opencompass/utils/text_postprocessors.py +++ b/opencompass/utils/text_postprocessors.py @@ -128,7 +128,10 @@ def first_option_postprocess(text: str, options: str, cushion=True) -> str: text = text.strip() match = re.search(pattern, text, re.DOTALL) if match: - outputs = match.group(1) + if match.group(1) is not None and match.group(1) != '': + outputs = match.group(1) + else: + outputs = match.group(0) for i in options: if i in outputs: return i