Skip to content

Progress

Progress is a simple interface that allows you to track the progress of a dataloader. Because a dataloader is a stateful iterator, you can use the progress() method to get the current progress of the iterator. This means no more manual calculations of the progress, dealing with batch sizes, or forgetting to update your progress tracking.

Tracking progress
from loadax import Dataloader, SimpleDataset

dataset = SimpleDataset([1, 2, 3, 4, 5])
dataloder = Dataloader(dataset, batch_size=2)

iterator = iter(dataloader)

for batch in iterator:
    print(batch)
    iterator.progress()

#> [1, 2]
#> Progress(items_processed=2, items_total=5)
#> [3, 4]
#> Progress(items_processed=4, items_total=5)
#> [5]
#> Progress(items_processed=5, items_total=5)

Progress metadata for a dataloader.

This metadata indicates how far the dataloader has progressed. This is useful for debugging and monitoring the progress of a dataloader.

Attributes:

Name Type Description
items_processed int

The number of items processed so far.

items_total int

The total number of items in the dataset.