import evaluate from evaluate.evaluation_suite import SubTask class Suite(evaluate.EvaluationSuite): def __init__(self, name): super().__init__(name) def setup(self): self.preprocessor = lambda x: {x["text"]: x["text"].lower()} # dataset.map(lambda example, idx: {"sentence2": f"{idx}: " + example["sentence2"]}, with_indices=True) self.suite = [ SubTask( task_type="text-classification", data="imdb", split="test[:10]", data_preprocessor=self.preprocessor, args_for_task={ "metric": "accuracy", "input_column": "text", "label_column": "label", "label_mapping": { "LABEL_0": 0.0, "LABEL_1": 1.0 } } ), SubTask( task_type="text-classification", data="sst2", split="test[:10]", data_preprocessor=self.preprocessor, args_for_task={ "metric": "accuracy", "input_column": "sentence", "label_column": "label", "label_mapping": { "LABEL_0": 0.0, "LABEL_1": 1.0 } } ) ]