hezar.data.data_samplers module

class hezar.data.data_samplers.RangedSampler(data: Sized, batch_size: int, start_index: int | None = None, end_index: int | None = None, drop_last: bool = False, shuffle: bool = False, seed: int | None = None)[source]

Bases: Sampler

A simple dataset sampler that samples the data from a starting index up to an ending index and also supports shuffling, drop_last, etc.

Parameters:
  • data – The dataset source

  • batch_size – Batch size

  • start_index – The starting index, will default to 0 if not given

  • end_index – The ending index, will default to the length of the data source

  • drop_last – Whether to drop the indices of the last batch

  • shuffle – Whether to shuffle indices

  • seed – Seed value for shuffling. Required if shuffle is True