(path: str, name: str)
| 14 | |
| 15 | @staticmethod |
| 16 | def load(path: str, name: str): |
| 17 | dataset = DatasetDict() |
| 18 | path = get_data_path(path) |
| 19 | # import pdb;pdb.set_trace() |
| 20 | for split in ['dev', 'test']: |
| 21 | raw_data = [] |
| 22 | filename = osp.join(path, split, f'{name}_benchmark.json') |
| 23 | # if split == 'test': |
| 24 | # _name = 'Solvent_Prediction' |
| 25 | # filename = f'/fs-computility/ai4sData/scidata/SFT_processed/molecule/test/ChemBench4K/test/tagged_json/{_name}_benchmark.json_processed.json' |
| 26 | # if split == 'dev': |
| 27 | # _name = 'Solvent_Prediction' |
| 28 | # filename = f'/fs-computility/ai4sData/scidata/SFT_processed/molecule/test/ChemBench4K/dev/tagged_json/{_name}_benchmark.json_processed.json' |
| 29 | with open(filename, 'r', encoding='utf-8') as json_file: |
| 30 | data = json.load(json_file) |
| 31 | |
| 32 | for item in data: |
| 33 | raw_data.append({ |
| 34 | 'input': item['question'], |
| 35 | 'A': item['A'], |
| 36 | 'B': item['B'], |
| 37 | 'C': item['C'], |
| 38 | 'D': item['D'], |
| 39 | 'target': item['answer'], |
| 40 | }) |
| 41 | |
| 42 | # if split == 'test': |
| 43 | # raw_data = raw_data[::10] |
| 44 | |
| 45 | dataset[split] = Dataset.from_list(raw_data) |
| 46 | return dataset |
| 47 | |
| 48 | @LOAD_DATASET.register_module() |
| 49 | class ChemBenchQADataset(BaseDataset): |
no test coverage detected