Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Can't pickle generator #44

Open
yogeshhk opened this issue Jun 10, 2021 · 7 comments
Open

Error: Can't pickle generator #44

yogeshhk opened this issue Jun 10, 2021 · 7 comments

Comments

@yogeshhk
Copy link

yogeshhk commented Jun 10, 2021

On Windows 10, with Python 3.6.5, getting error on running

tf2_gnn_train RGCN PPI --max-epochs 10 data/ppi/

log is:

2021-06-10 18:44:04.837559: W tensorflow/core/framework/op_kernel.cc:1755] Invalid argument: TypeError: cannot pickle 'generator' object
Traceback (most recent call last):

  File "C:\Users\yogesh.kulkarni\AppData\Local\Continuum\anaconda3\envs\tf2\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 789, in get_iterator
    return self._iterators[iterator_id]

KeyError: 0

Any resolution?

@yogeshhk yogeshhk changed the title Error: Can't pickle iterator Error: Can't pickle generator Jun 10, 2021
@mmjb
Copy link
Contributor

mmjb commented Jun 10, 2021

Could you tell what Tensorflow version you were using?

@yogeshhk
Copy link
Author

tensorflow 2.5
Python 3.8.8
CPU

@lh98cool
Copy link

lh98cool commented Aug 1, 2021

I faced the same problem, how to fix it bro?

@yogeshhk
Copy link
Author

yogeshhk commented Aug 2, 2021

@lh98cool: did not find any solution yet.

@097475
Copy link

097475 commented Dec 2, 2021

Any updates?

@097475
Copy link

097475 commented Dec 20, 2021

I have found a temporary fix for this issue.
In file graph_dataset.py, line 294, make a list out of self.graph_batch_iterator(data_fold)
E.g. it should look like something like this:
if use_worker_threads: graph_batch_iterator = lambda: DoubleBufferedIterator( list(self.graph_batch_iterator(data_fold)) )

Alternatively, disable multithreding by setting use_worker_threads to False in line 79.

@NipunaChhabra
Copy link

I got the same error on mac(Big Sur), but it worked on Colab so for now I'm using that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants