| 131 | |
| 132 | |
| 133 | class MultiTaskDataset(Dataset): |
| 134 | |
| 135 | def __init__(self, meta_args, name2dataset: Dict[str, Dataset], split: str): |
| 136 | self.meta_args = meta_args |
| 137 | |
| 138 | self.data = MultiTaskWrapper(name2dataset=name2dataset, meta_args=meta_args, split=split) |
| 139 | |
| 140 | def __getitem__(self, index): |
| 141 | data = self.data[index] |
| 142 | model_inputs = { |
| 143 | k: data[k] for k in data['model_kwargs'] |
| 144 | } |
| 145 | return model_inputs |
| 146 | |
| 147 | def __len__(self): |
| 148 | return len(self.data) |
no outgoing calls
no test coverage detected