tensorflow / datasets

TFDS is a collection of datasets ready to use with TensorFlow, Jax, ...
https://www.tensorflow.org/datasets
Apache License 2.0
4.32k stars 1.56k forks source link

Unable to Load TF Dataset given the Max Recursion Error #4666

Closed dsurwolee closed 6 months ago

dsurwolee commented 1 year ago

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)

Alvov1 commented 9 months ago

Same here, year later. MacOS Sonoma 14.3.1 ARM, Python 3.12, tensorflow-datasets 4.9.4, tensorflow 2.16.0rc0

jonasvonarb commented 9 months ago

Same here. MacOs Ventura 13.4 ARM & MacOs Sonoma ARM, Python 3.12.2, tensorflow-datasets 4.9.4, tensorflow 2.16.0rc0

jonasvonarb commented 9 months ago

Same here. MacOs Ventura 13.4 ARM & MacOs Sonoma ARM, Python 3.12.2, tensorflow-datasets 4.9.4, tensorflow 2.16.0rc0

@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!

cleong110 commented 8 months ago

Same here, Ubuntu 22.04, Python 3.12, tfds-nightly 4.9.3.dev202310060044. Switching to Python 3.10 via conda did indeed fix the issue

romanngg commented 8 months ago

I am also experiencing an infinite recursion on Python 3.12 (but OK on other versions): https://github.com/romanngg/neural-tangents/actions/runs/8469568618/job/23205199748

ayaka14732 commented 8 months ago

I have encountered the same issue on Debian, Python 3.12.1, tensorflow-datasets 4.9.4.

ayaka14732 commented 8 months ago

Please change the issue label from "help" to "bug".

hiraSyeda commented 7 months ago

Hi, I am experiencing the similar issue! macOS Sonoma 14.4.1

mikehb commented 7 months ago

I am having the same issue on Fedora 39, with python 3.12.2

amitchandna commented 7 months ago

I am also having the same issue;

Python 3.12.0 OS: Ventura 13.5 tensorflow-datasets : 4.9.4 tensorflow: 2.16.1

BoyoChen commented 7 months ago

Same here:

Python 3.12.0 OS: Ubuntu 22.04.3 LTS tensorflow-datasets : 4.9.4 tensorflow: 2.16.1

WrexFC commented 7 months ago

Im having the same problem too with: Python 3.12.2 tensorflow datasets 4.9.4 tensorflow 2.16.1 Windows 11 version 23H2

Oluwasunmibola commented 7 months ago

I'm having the same issue Mac M1

nkt780426 commented 7 months ago

I have the same issue Python 3.12 tensorflow 2.16.1 (gpu) tensorflow-datasets : 4.9.4 GPU: NVIDIA Geforce 1650 WSL2-Ubuntu

jkarwowski commented 7 months ago

Same problem:

Python 3.12.1 OS: Ubuntu 22.04.1 LTS GPU: NVIDIA GeForce 3060 tensorflow==2.16.1 tensorflow-datasets==4.9.4

Oluwasunmibola commented 7 months ago

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.

ODAncona commented 7 months ago

Same with :

python 3.12.2 OS: Ubuntu 23.10 x86_64 GPU: NVIDIA GeForce RTX 2080 SUPER tensorflow==2.16.1 tensorflow-datasets==4.9.4

pedrocormann commented 6 months ago

Same here. MacOS Sonoma 14.3.1 M2, Python 3.12, tensorflow-datasets 4.9.4, tensorflow 2.16.1

abir-g commented 6 months ago

I have the same issue. I solved it by switching to 3.10.11 version of python.

RaffaeleMarino commented 6 months ago

I have the same issue.

RaffaeleMarino commented 6 months ago

However using a conda env and a python3.10 I solved the issue.

marcenacp commented 6 months ago

This issue should be fixed in TFDS v4.9.6 that supports python 3.10, 3.11 and 3.12 (see the GitHub Actions). Feel free to reopen if you still have the problem!