nlpstack.data.dataloaders module#
- class nlpstack.data.dataloaders.BasicBatchSampler(batch_size, shuffle=False, drop_last=False)[source]#
Bases:
BatchSamplerA basic batch sampler that generates batches of indices from a dataset.
- Parameters:
batch_size (
int) – The batch size.shuffle (
bool) – Whether to shuffle the dataset before sampling.drop_last (
bool) – Whether to drop the last batch if it is smaller than the batch size.
- class nlpstack.data.dataloaders.BatchIterator(dataset, sampler)[source]#
Bases:
object- Parameters:
dataset (Sequence[Instance]) –
sampler (BatchSampler) –
- class nlpstack.data.dataloaders.BatchSampler[source]#
Bases:
objectA batch sampler is responsible for generating batches of indices from a dataset.
- class nlpstack.data.dataloaders.DataLoader(sampler)[source]#
Bases:
objectA data loader is responsible for iterating over batches of instances from a dataset.
- Parameters:
sampler (
BatchSampler) – The batch sampler to use.