tuning_component.limited_sampler
LimitedSampler Objects
class LimitedSampler(Sampler)
__init__
def __init__(dataset: Sized,
shuffle: bool = True,
seed: int = 0,
round_up: bool = True,
limited_samples: int = 1024) -> None
Initializes the LimitedSampler.
Arguments:
dataset
Sized - The dataset to sample from.shuffle
bool, optional - Whether to shuffle the dataset. Defaults to True.seed
int, optional - The random seed for shuffling. Defaults to 0.round_up
bool, optional - Whether to round up the number of samples per process. Defaults to True.limited_samples
int, optional - The maximum number of samples to use. Defaults to 1024.
__iter__
def __iter__() -> Iterator[int]
Returns an iterator over the sampled indices.
Yields:
Iterator[int]
- An iterator yielding the sampled indices.
__len__
def __len__() -> int
Returns the number of samples in the sampler.
Returns:
int
- The number of samples.
set_epoch
def set_epoch(epoch: int) -> None
Sets the current epoch.
Arguments:
epoch
int - The epoch number.