Open rafadotnechi opened 5 months ago
The error message indicates that the tree module does not have the map_structure attribute. This could happen if tree is not properly installed or if there’s an incompatible version.
Here’s a step-by-step approach to help resolve this issue:
1) Check Dependencies: Ensure that the tree module (which is part of dm-tree) is correctly installed. You can install or upgrade it with the following command: pip install -U dm-tree
2) Check Version Compatibility: Some versions of TensorFlow and TensorFlow Datasets may require a specific version of dm-tree. If you’ve updated TensorFlow or TensorFlow Datasets recently, it’s possible that dm-tree also needs an update. Make sure all packages are compatible by running: pip install --upgrade tensorflow tensorflow-datasets dm-tree
3) Reinstall TensorFlow Datasets and TensorFlow: In case the issue persists, try reinstalling both tensorflow and tensorflow-datasets. This can help resolve any hidden compatibility issues or corrupted installations: pip uninstall tensorflow tensorflow-datasets dm-tree pip install tensorflow tfds-nightly dm-tree
4) Check Alternative Imports: If the above steps don't resolve the issue, you could check for alternative ways to load the dataset: import tensorflow as tf import tensorflow_datasets as tfds
try: ds = tfds.load('mnist', split='train', as_supervised=True, shuffle_files=True) except AttributeError as e: print(f"Error loading dataset: {e}")
5) Restart the Environment: Sometimes, restarting your Python environment can help clear out any lingering issues.
/!\ PLEASE INCLUDE THE FULL STACKTRACE AND CODE SNIPPET
Short description Description of the bug.
Environment information
Operating System: Windows 10
Python version: Python 3.12.4
tensorflow-datasets
/tfds-nightly
tensorflow-datasets / version: Version: 4.9.6tensorflow
/tf-nightly
version: tensorflow / Version: 2.16.1Does the issue still exists with the last
tfds-nightly
package (pip install --upgrade tfds-nightly
) ?Yes
Reproduction instructions load any dataset
Stacktrace