Hi,
You’re right, I changed my dataclass to open the file in __init__ and it opens much faster and retreives data quickly.  I tried to use more than one worker, but I will still get an OS b-tree error. Upon investigation, if I were to just print paths, I would also get labels and sometimes empty arrays before the b-tree error. It works with num_of_workers set to 0, however, I’m assuming that will make things incredibly slow. Nevertheless, here is the updated class:
import torch.multiprocessing as mp
mp.set_start_method('fork')

from torch.utils import data
import h5py

class Features_Dataset(data.Dataset):
    def __init__(self, archive, phase):
        self.archive = h5py.File(archive, 'r', libver='latest', swmr=True)
        assert self.archive.swmr_mode
        self.labels = self.archive[str(phase) + '_labels']
        self.data = self.archive[str(phase) + '_all_arrays']
        self.img_paths = self.archive[str(phase) + '_img_paths']

    def __getitem__(self, index):
        datum = self.data[index]
        label = self.labels[index]
        path = self.img_paths[index]
        return datum, label, path

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

    def close(self):
        self.archive.close()

if __name__ == '__main__':
    train_dataset = Features_Dataset(archive= "featuresdata/train.hdf5", phase= 'train')
    trainloader = data.DataLoader(train_dataset, num_workers=0, batch_size=1)
    print(len(trainloader))
    for i, (data, label, path) in enumerate(trainloader):
        print(path)

I still get 0% utilization from the GPUs. Is it a problem with HDF5? Are there alternatives to use instead of hdf5, for example, loading into numpy arrays or would that be just as slow? I will eventually have hdf5 datasets that will contain 2,000,000 instances. This is merely a pilot test!