max_timestamp_batch_sampler#
(s3prl.dataio.sampler.max_timestamp_batch_sampler)
Limit the maximum timestamps in a batch to realize dynamic batching.
- Authors:
Leo 2022
MaxTimestampBatchSampler#
- class s3prl.dataio.sampler.max_timestamp_batch_sampler.MaxTimestampBatchSampler(lengths: List[int], max_length: int, shuffle: bool = False, seed: int = 12345678, reduce_func: Optional[callable] = None)[source][source]#
Bases:
object
The reduced timestamps for a batch should not exceed the max_timestamp. If shuffled, each indices are first shuffled before aggregated into batches