Anyway if you artificially enlarge the number that dataset. len  returns you will be able to.

Thank you. That give me an idea to simply take the modulo of dataset.len, allowing me to set a batch size larger then the size of the dataset. I still needed to set __len__ to return a larger number, either the length of the dataframe or the batch size.

Set the length of the dataset to be the max over the dataset length or the batch size

def __len__(self):
    return max(len(self.df),args.batch_size)


Take the modulo idx by the actual length of the data

    def __getitem__(self, idx):
        idx = idx % self.data_len

Template below
class uti_dataset(torch.utils.data.Dataset):
    def __init__(self, args, data_path):
    
    # load dataset
    self.df = pd.Dataframe()
    ...
    self.data_len = len(self.df)
            
def __len__(self):
    return max(len(self.df),args.batch_size)

def __getitem__(self, idx):
    idx = idx % self.data_len
    filenames = self.df.iloc[idx]["filepaths"]
    # load and transform data
    # ...
    return images