From 662dddf41a44b643f8537418e73c600628e45953 Mon Sep 17 00:00:00 2001 From: Linchen Xiao Date: Thu, 24 Oct 2024 17:45:21 +0800 Subject: [PATCH] [Update] Add internal humaneval postprocess (#1636) --- opencompass/datasets/humaneval.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/opencompass/datasets/humaneval.py b/opencompass/datasets/humaneval.py index 98acdf41..533c6a2d 100644 --- a/opencompass/datasets/humaneval.py +++ b/opencompass/datasets/humaneval.py @@ -184,3 +184,17 @@ def humaneval_postprocess_v2(text: str) -> str: if len(blocks) >= 1: text = blocks[0] return text + + +def humaneval_internal_v2_postprocess(text: str): + if text.startswith(' ') and not text.startswith(' '): + text = ' ' + text + prediction = text.split('\n\n\n')[0] + prediction = prediction.split('\n```')[0] + prediction_list = prediction.split('\n') + return_list = [] + for line in prediction_list: + if line and line[0] != ' ': + break + return_list.append(line) + return '\n'.join(return_list)