I have multiple csv files which contain 1D data and I want to use each row. Each file contains different number of rows. So I have written a dataloader like this:
I’m not sure I understand the issue correctly.
The mentioned output is created in the __init__, so it seems the Dataset is initialized properly.
What kind of issue are you seeing when calling train_dl_spec[0]?
You are passing a train_files[0] that is a string to self.files. No sure if I fully understand your question. I guess you want data_gen(train_files)[0] to invoke __getitem__ from data_gen instance.
And now, it’s working when I call train_loader = torch.utils.data.DataLoader( train_dl_spec, batch_size=128, shuffle=True, num_workers=8, pin_memory=True)