OpenCompass/opencompass/datasets/wnli.py
Hubert a11cb45c83
[Feat] implementation for support promptbench (#239)
* [Feat] support adv_glue dataset for adversarial robustness

* reorg files

* minor fix

* minor fix

* support prompt bench demo

* minor fix

* minor fix

* minor fix

* minor fix

* minor fix

* minor fix

* minor fix

* minor fix
2023-09-15 15:06:53 +08:00

27 lines
560 B
Python

from datasets import load_dataset
from opencompass.registry import LOAD_DATASET
from .base import BaseDataset
@LOAD_DATASET.register_module()
class wnliDataset(BaseDataset):
@staticmethod
def load(**kwargs):
dataset = load_dataset(**kwargs)
# dataset = dataset['validation']
gt_dict = {
1: 'A',
0: 'B',
-1: -1,
}
def preprocess(example):
example['label_option'] = gt_dict[example['label']]
return example
return dataset.map(preprocess)