IterBasedTrainLoop¶
- class mmengine.runner.IterBasedTrainLoop(runner, dataloader, max_iters, val_begin=1, val_interval=1000, dynamic_intervals=None, fast_forward_on_resume=False)[source]¶
Loop for iter-based training.
- Parameters:
runner (Runner) – A reference of runner.
dataloader (Dataloader or dict) – A dataloader object or a dict to build a dataloader.
max_iters (int) – Total training iterations.
val_begin (int) – The iteration that begins validating. Defaults to 1.
val_interval (int) – Validation interval. Defaults to 1000.
dynamic_intervals (List[Tuple[int, int]], optional) – The first element in the tuple is a milestone and the second element is a interval. The interval is used after the corresponding milestone. Defaults to None.
fast_forward_on_resume (bool) – Whether to skip advancing the dataloader iterator when resuming from a checkpoint. When False (default), the dataloader is advanced through the already-trained steps to maintain training state consistency. If the sampler supports a skip method (e.g.
InfiniteSampler) and the batch size can be resolved, this advance is done cheaply at the sampler level without loading the skipped data; otherwise it falls back to advancing the dataloader iterator step by step. When True, this fast-forward is skipped to save time, but may affect reproducibility if the dataloader has state-dependent behavior.