datasets icon indicating copy to clipboard operation
datasets copied to clipboard

Unable to Load TF Dataset given the Max Recursion Error

Open dsurwolee opened this issue 2 years ago • 18 comments

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.2
  • tensorflow: version: 2.10

dsurwolee avatar Jan 19 '23 13:01 dsurwolee

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

Alvov1 avatar Mar 04 '24 18:03 Alvov1

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

jonasvonarb avatar Mar 05 '24 09:03 jonasvonarb

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!

jonasvonarb avatar Mar 05 '24 10:03 jonasvonarb

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

cleong110 avatar Mar 26 '24 19:03 cleong110

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

romanngg avatar Mar 28 '24 15:03 romanngg

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

ayaka14732 avatar Apr 02 '24 10:04 ayaka14732

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

ayaka14732 avatar Apr 02 '24 10:04 ayaka14732

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

hiraSyeda avatar Apr 10 '24 03:04 hiraSyeda

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

mikehb avatar Apr 10 '24 07:04 mikehb

I am also having the same issue;

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

amitchandna avatar Apr 13 '24 18:04 amitchandna

Same here:

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

BoyoChen avatar Apr 14 '24 18:04 BoyoChen

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

WrexFC avatar Apr 23 '24 06:04 WrexFC

I'm having the same issue Mac M1

Oluwasunmibola avatar Apr 23 '24 15:04 Oluwasunmibola

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

nkt780426 avatar Apr 25 '24 02:04 nkt780426

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

jkarwowski avatar Apr 25 '24 03:04 jkarwowski

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.

Oluwasunmibola avatar Apr 25 '24 03:04 Oluwasunmibola

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

ODAncona avatar May 05 '24 19:05 ODAncona

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

pedrocormann avatar May 13 '24 02:05 pedrocormann

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

abir-g avatar May 25 '24 11:05 abir-g

I have the same issue.

RaffaeleMarino avatar May 28 '24 21:05 RaffaeleMarino

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

RaffaeleMarino avatar May 28 '24 21:05 RaffaeleMarino

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!

marcenacp avatar Jun 05 '24 08:06 marcenacp