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

Method load

opencompass/datasets/multirc.py:49–66  ·  view source on GitHub ↗
(path: str)

Source from the content-addressed store, hash-verified

47
48 @staticmethod
49 def load(path: str):
50 path = get_data_path(path, local_mode=True)
51 with open(path, 'r', errors='ignore') as in_f:
52 rows = []
53 for line in in_f:
54 sample = json.loads(line.strip())
55 text = sample['passage']['text']
56 for question_dict in sample['passage']['questions']:
57 question = question_dict['question']
58 answers = question_dict['answers']
59 for answer in answers:
60 rows.append({
61 'text': text,
62 'question': question,
63 'answer': answer['text'],
64 'label': 'BA'[answer['label']]
65 })
66 return Dataset.from_list(rows)

Callers

nothing calls this directly

Calls 2

get_data_pathFunction · 0.90
openFunction · 0.85

Tested by

no test coverage detected