You have to define a dataset:
https://pytorch.org/docs/stable/data.html#torch.utils.data.Dataset 25
Dataset is an iterator prepared to work with dataloader
You have to set your dataset:
class BinaryData(torch.utils.data.Dataset):

    def __init__(self, root_dir,transform):
Define here basics of your dataset, such as directory. I enlist all the files inside my dataset and use it as list for reading data later.
        self.input_list = []
        self.transform = transform
        for path, subdirs, files in os.walk(root_dir):
            for name in files:
                self.input_list.append(os.path.join(path, name))

    def __len__(self):
        return len(self.input_list)

    def __getitem__(self, idx):
Here you have to load your data using whatever you want, you can see last one I did as an example. Here I was loading python dictionaries. You can return the data with the structure you want
        dic = data2dic(np.load(self.input_list[idx]))
        audio = dic['audio']
        if audio.shape !=(256,256):
            audio = np.resize(audio,(256,256))
        frames = dic['frames']
        size = np.shape(frames)
        images = []
        for i in range(size[3]):
            images.append(self.transform(Image.fromarray(frames[:,:,:,i])))
        frames = torch.stack(images)
        return audio,frames 

Independently of how your data is stored, you can manage and modify it when you call the function. Gettiem is warped with dataloader so each time you call dataloder it will provide data with the structure of getitem’s return