MCPcopy Create free account
hub / github.com/InternScience/SciReason / post_process

Function post_process

opencompass/datasets/subjective/commonbench.py:11–23  ·  view source on GitHub ↗

Input a string like below: xxx[[5]]xxx, and extract the score

(judgement: str)

Source from the content-addressed store, hash-verified

9
10
11def post_process(judgement: str):
12 """Input a string like below:
13
14 xxx[[5]]xxx, and extract the score
15 """
16 judgement = judgement['prediction']
17 pattern = r'\[\[([\d.]+)\]\]'
18 matched_result = re.findall(pattern, judgement)
19 if matched_result:
20 score = float(matched_result[0])
21 else:
22 return None
23 return {'score': score}
24
25
26def get_capability_results(judged_answers, references):

Callers 2

get_judgeanswerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected