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

Method load

opencompass/datasets/Medbullets.py:40–57  ·  view source on GitHub ↗
(path: str, prompt_mode: str = 'zero-shot', **kwargs)

Source from the content-addressed store, hash-verified

38
39 @staticmethod
40 def load(path: str, prompt_mode: str = 'zero-shot', **kwargs):
41 # 读取 CSV 文件为 DataFrame,并将 NaN 转为空字符串
42 path = get_data_path(path)
43 df = pd.read_csv(path, encoding='utf-8')
44 df = df.fillna('')
45
46 # 转换为字典列表
47 data_list = df.to_dict(orient='records')
48
49 # 将数据列表包装为 Dataset
50 dataset = Dataset.from_list(data_list)
51
52 # 根据提示模式进行解析
53 if prompt_mode == 'zero-shot':
54 dataset = dataset.map(lambda item: _parse(item, prompt_mode))
55 elif prompt_mode == 'few-shot':
56 pass # TODO: Implement few-shot prompt handling
57 return dataset
58
59
60class MedbulletsEvaluator(BaseEvaluator):

Callers

nothing calls this directly

Calls 3

get_data_pathFunction · 0.90
_parseFunction · 0.70
to_dictMethod · 0.45

Tested by

no test coverage detected