Skip to content

Instantly share code, notes, and snippets.

View jackdeansmith's full-sized avatar

Jack Smith jackdeansmith

  • Google
  • Seattle WA
View GitHub Profile
@MFreidank
MFreidank / infinite_dataloader.py
Last active October 16, 2023 13:36
A pytorch DataLoader that generates an unbounded/infinite number of minibatches from the dataset.
from torch.utils.data import DataLoader
class InfiniteDataLoader(DataLoader):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Initialize an iterator over the dataset.
self.dataset_iterator = super().__iter__()
def __iter__(self):