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

Function get_circular_example

opencompass/datasets/mathbench.py:21–43  ·  view source on GitHub ↗

For given example, generate four circular examples.

(entry, id)

Source from the content-addressed store, hash-verified

19
20
21def get_circular_example(entry, id):
22 """For given example, generate four circular examples."""
23 # Only 4 options is supported for current circular eval.
24 circular_patterns = ['ABCD', 'BCDA', 'CDAB', 'DABC']
25 data = []
26 for c in circular_patterns:
27 line = copy.deepcopy(entry)
28 options = []
29 for i in range(4):
30 options.append(line['options'][ord(c[i]) - ord('A')])
31 line['options'] = options
32 line['answer'] = {
33 c[0]: 'A',
34 c[1]: 'B',
35 c[2]: 'C',
36 c[3]: 'D'
37 }[line['answer']]
38 line['answer'] = str(id) + '--' + line['answer'] + '--' + c
39 line['question'] = line['question'].strip() + '\n' + get_number(
40 line['options'])
41 data.append(line)
42
43 return data
44
45
46@LOAD_DATASET.register_module()

Callers 2

loadMethod · 0.70
loadMethod · 0.70

Calls 1

get_numberFunction · 0.70

Tested by

no test coverage detected