In my case, error said ‘h5py object cannnot be pickled’. And I think the reason is that python will copy all member variable of class when use multiprocess, while h5py object cannot be copy for different process.
So if you set num_workers=0, it will avoid this error. And my solution is avoiding use h5py object as a member variable.
By the way, the true reason of using self.classes = list(data_dict.keys()) maybe that the type of data_dict.keys() in python3 is <class 'dict_keys'>, which cannot be pickled either.