Getting a "UnpicklingError: invalid load key, '\xff'." error

This is some kind of data loading issue. Pickle is a Python de/serialization module used in Dataloader. /xff might refer to hexademical FF. So most probably you are going out of range, perhaps trying to access a resource that does not exist?

X = torch.load(root_dir + ID)

I suggest to debug or print out root_dir + ID and see if the file really exists (or perhaps it does, but can not be unpickled, e.g., corrupted, wrong format etc).