Skip to content

Commit

Permalink
Update math with llm judge
Browse files Browse the repository at this point in the history
  • Loading branch information
liushz committed Nov 25, 2024
1 parent 17d2a7f commit 165e8a7
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions opencompass/datasets/compassbench_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,35 @@ def load(path: str, name: str):
return dataset


@LOAD_DATASET.register_module()
class CompassBenchObjectiveMath(BaseDataset):

@staticmethod
def load(path: str):
with open(path, 'r') as infile:
data = [json.loads(line) for line in infile]
for idx in range(len(data)):
item = data[idx]
prefix = ''
if item.get('question_type',
None) and item['question_type'] in [
'multiple-answer', '多选题'
]:
if '_en_' in path:
prefix = 'This question may has multiple answers, \
please select all correct answers. like this: A, B, C as your final answer\n'

else:
prefix = '这道题可能有多个正确答案,请选择所有正确的答案,\
例如:A, B, C 作为你的最终答案\n'

if item.get('options', None) and len(item['options']) != 0:
item['question'] = prefix + item[
'question'] + '\n' + get_number(item['options'])
dataset = Dataset.from_list(data)
return dataset


@TEXT_POSTPROCESSORS.register_module()
def compassbench_objective_v1_3_postprocess(text: str, name) -> str:
split = False
Expand Down

0 comments on commit 165e8a7

Please sign in to comment.