multitask
allennlp.data.dataset_readers.multitask
MultiTaskDatasetReader¶
@DatasetReader.register("multitask")
class MultiTaskDatasetReader(DatasetReader):
| def __init__(self, readers: Dict[str, DatasetReader]) -> None
This DatasetReader
simply collects a dictionary of other DatasetReaders
. It is designed for
a different class (the MultiTaskDataLoader
) to actually read from each of the underlying
dataset readers, and so this really is just a glorified dictionary that we can construct as a
DatasetReader
. We throw an error if you try to actually call read()
, because you should be
doing that differently.
Registered as a DatasetReader
with name "multitask".
Parameters¶
- readers :
Dict[str, DatasetReader]
A mapping from dataset name toDatasetReader
objects for reading that dataset. You can use whatever names you want for the datasets, but they have to match the keys you use for data files and in other places in theMultiTaskDataLoader
andMultiTaskScheduler
.
read¶
class MultiTaskDatasetReader(DatasetReader):
| ...
| def read(
| self,
| file_paths: Union[PathLike, str, Dict[str, Union[PathLike, str]]],
| *, force_task: Optional[str] = None
| ) -> Union[Iterator[Instance], Dict[str, Iterator[Instance]]]