The error points towards an invalid indexing operation in:
item = {k: torch.tensor(v[idx]) for k, v in self.encodings.items()}

which fails in the data loading step.
I would recommend to iterate the Dataset and DataLoader for a full epoch and make sure all samples can be loaded properly.