You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DataProcessor objects that make super() calls fail to pickle. This is an issue in dill that was apparently resolved in a recent PR, but there has not been a new release of the package to incorporate this change.
The text was updated successfully, but these errors were encountered:
As a workaround, you can do the following. This example is from tests/dataset/doubled_preset_data_processor.py.
Original:
classDoubledPresetDataProcessor(PresetDataProcessor):
"""Processes a preset dataset, with no file I/O; doubles tensor values."""defget_raw_features_and_labels(self, dataset_path: str) -> \
Tuple[Dict[str, np.ndarray], Dict[str, np.ndarray]]:
"""Returns doubled preset raw feature and label tensors. :param dataset_path: Unused :return: A 2-tuple of the features dictionary and labels dictionary, with matching keys and ordered tensors. """# This will cause a pickling error.features, labels=super().get_raw_features_and_labels(dataset_path)
forname, tensorinfeatures.items():
features[name] =2*tensorreturnfeatures, labels
Workaround:
classDoubledPresetDataProcessor(PresetDataProcessor):
"""Processes a preset dataset, with no file I/O; doubles tensor values."""defget_raw_features_and_labels(self, dataset_path: str) -> \
Tuple[Dict[str, np.ndarray], Dict[str, np.ndarray]]:
"""Returns doubled preset raw feature and label tensors. :param dataset_path: Unused :return: A 2-tuple of the features dictionary and labels dictionary, with matching keys and ordered tensors. """# See #49 for why we can't use super().features, labels=PresetDataProcessor.get_raw_features_and_labels(
self, dataset_path)
forname, tensorinfeatures.items():
features[name] =2*tensorreturnfeatures, labels
DataProcessor objects that make super() calls fail to pickle. This is an issue in dill that was apparently resolved in a recent PR, but there has not been a new release of the package to incorporate this change.
The text was updated successfully, but these errors were encountered: