Could you provide a bit more informations about your use case ?
Why can’t you identify indices that correspond to corrupted file, for instance during the dataset instanciation, by looping one time over all the files, or even simplier identify those files before the dataset instanciation ?
In your training loop, I assume you’re doing something alike
for batch in dataloader:
    inputs, targets = batch
    outputs = model(inputs)
    ...

Can’t you detect batches to skip in this loop ?
If for some reasons you can’t do any of these propositions, you have to possibility to define a Sampler object that will be use by a DataLoader object to samples indices. Those indices will then be used to call the  __getitem__ method of a Dataset object. Check the doc of pytorch.utils.data 1 for more infos. Perhaps in the __next__ method of your sampler you could try and detect corrupted files and avoid yielding them so that the __getitem__ method will never be called with their corresponding indices.
I hope I’m being clear, feel free to ask for more details of course.