mirror of
https://github.com/open-compass/opencompass.git
synced 2025-05-30 16:03:24 +08:00
[Update] Add internal humaneval postprocess (#1636)
This commit is contained in:
parent
be3c06a158
commit
662dddf41a
@ -184,3 +184,17 @@ def humaneval_postprocess_v2(text: str) -> str:
|
|||||||
if len(blocks) >= 1:
|
if len(blocks) >= 1:
|
||||||
text = blocks[0]
|
text = blocks[0]
|
||||||
return text
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user