Skip to content

simple_data_loader

allennlp.data.data_loaders.simple_data_loader

[SOURCE]


SimpleDataLoader

@DataLoader.register("simple", constructor="from_dataset_reader")
class SimpleDataLoader(DataLoader):
 | def __init__(
 |     self,
 |     instances: List[Instance],
 |     batch_size: int,
 |     *,
 |     shuffle: bool = False,
 |     batches_per_epoch: Optional[int] = None,
 |     vocab: Optional[Vocabulary] = None
 | ) -> None

A very simple DataLoader that is mostly used for testing.

__iter__

class SimpleDataLoader(DataLoader):
 | ...
 | def __iter__(self) -> Iterator[TensorDict]

iter_instances

class SimpleDataLoader(DataLoader):
 | ...
 | def iter_instances(self) -> Iterator[Instance]

index_with

class SimpleDataLoader(DataLoader):
 | ...
 | def index_with(self, vocab: Vocabulary) -> None

set_target_device

class SimpleDataLoader(DataLoader):
 | ...
 | def set_target_device(self, device: torch.device) -> None

from_dataset_reader

class SimpleDataLoader(DataLoader):
 | ...
 | @classmethod
 | def from_dataset_reader(
 |     cls,
 |     reader: DatasetReader,
 |     data_path: str,
 |     batch_size: int,
 |     shuffle: bool = False,
 |     batches_per_epoch: Optional[int] = None,
 |     quiet: bool = False
 | ) -> "SimpleDataLoader"