File size: 523 Bytes
256a159 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import json
from datasets import Dataset, DatasetDict
from .base import BaseDataset
class CrowspairsDataset_CN(BaseDataset):
@staticmethod
def load(path):
data = []
with open(path, 'r') as f:
for line in f:
item = json.loads(line)
data.append(item)
def preprocess(example):
example['label'] = 'A'
return example
dataset = Dataset.from_list(data).map(preprocess)
return DatasetDict({'test': dataset})
|