datasets: Unable to Load TF Dataset given the Max Recursion Error
What I need help with / What I was wondering I am unable to load a tensorflow dataset in my local environment given the following error:
RecursionError: maximum recursion depth exceeded
What I’ve tried so far I have tried loading “movielens/100k-ratings” using the load dataset function call in the following manner:
movie_lens = tfds.load('movielens/100k-ratings')
I’ve also tried loading other datasets found in the tensorflow dataset collection - to no avail.
Download stage works, but the extraction stage is where it fails. Looking at the error log, it seems that the breakage is happening during the flattening process of the datafile:
`~/opt/anaconda3/envs/rec-engine/lib/python3.9/site-packages/tensorflow_datasets/core/download/download_manager.py in _map_promise(map_fn, all_inputs) 827 map_fn, all_inputs 828 ) # Apply the function –> 829 res = tree_utils.map_structure( 830 lambda p: p.get(), all_promises 831 ) # Wait promises
~/opt/anaconda3/envs/rec-engine/lib/python3.9/site-packages/tree/init.py in map_structure(func, *structures, **kwargs) 433 assert_same_structure(structures[0], other, check_types=check_types) 434 return unflatten_as(structures[0], –> 435 [func(*args) for args in zip(*map(flatten, structures))]) 436 437
~/opt/anaconda3/envs/rec-engine/lib/python3.9/site-packages/tree/init.py in flatten(structure)
229 TypeError: If structure is or contains a mapping with non-sortable keys.
230 “”"
–> 231 return _tree.flatten(structure)
232
233
~/opt/anaconda3/envs/rec-engine/lib/python3.9/abc.py in instancecheck(cls, instance) 117 def instancecheck(cls, instance): 118 “”“Override for isinstance(instance, cls).”“” –> 119 return _abc_instancecheck(cls, instance) 120 121 def subclasscheck(cls, subclass):
~/opt/anaconda3/envs/rec-engine/lib/python3.9/abc.py in subclasscheck(cls, subclass) 121 def subclasscheck(cls, subclass): 122 “”“Override for issubclass(subclass, cls).”“” –> 123 return _abc_subclasscheck(cls, subclass) 124 125 def _dump_registry(cls, file=None):
… last 1 frames repeated, from the frame below …
~/opt/anaconda3/envs/rec-engine/lib/python3.9/abc.py in subclasscheck(cls, subclass) 121 def subclasscheck(cls, subclass): 122 “”“Override for issubclass(subclass, cls).”“” –> 123 return _abc_subclasscheck(cls, subclass) 124 125 def _dump_registry(cls, file=None):`
It would be nice if… I’d appreciate any inputs on how to fix this as, ideally, I would want to avoid manually downloading the datasets then creating tensors on those data objects.
Environment information (if applicable)
- Operating System: MacOs Monterey (12.3)
- Python version: Python 3.9 (Anaconda)
tensorflow-datasets: 4.8.2tensorflow: version: 2.10
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 10
- Comments: 23
@Alvov1 I managed to get it to work by downgrading to Python Version 3.10.12 → Same as this Google-Notebook https://www.tensorflow.org/tutorials/images/segmentation
But would still be nice to have a solution with the newest version of Python!
Same here, year later. MacOS Sonoma 14.3.1 ARM, Python 3.12, tensorflow-datasets 4.9.4, tensorflow 2.16.0rc0
I have the same issue. I solved it by switching to 3.10.11 version of python.
I think it’s a problem with the 2.16 version. I looked at the documentation I think you can only save your model using .keras.
Same here. MacOs Ventura 13.4 ARM & MacOs Sonoma ARM, Python 3.12.2, tensorflow-datasets 4.9.4, tensorflow 2.16.0rc0