A solution worked for me was making a generator function using itertools.repeat.
from itertools import repeat

def repeater(data_loader):
    for loader in repeat(data_loader):
        for data in loader:
            yield data

Then
data_loader = DataLoader(dataset, ...)
data_loader = repeater(data_loader)

for data in data_loader:
    # train your model