[Update] Add internal humaneval postprocess (#1636)

This commit is contained in:
Linchen Xiao 2024-10-24 17:45:21 +08:00 committed by GitHub
parent be3c06a158
commit 662dddf41a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)