question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Can't pickle generator

See original GitHub issue

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?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
097475commented, 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.

0reactions
NipunaChhabracommented, Jul 5, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: can't pickle generator objects - Stack Overflow
This is a generator. As the error says, we cannot pickle generators. Use this instead. raw_X=[] for text in data: raw_X.append ...
Read more >
{TypeError} cannot pickle 'generator' object due to the context ...
When using DaskExecutor , prefect tries to pickle each task, which results in the error {TypeError} cannot pickle 'generator' object due to ...
Read more >
Issue 39817: CRITICAL: TypeError: cannot pickle 'generator'
I use Windows 10 Home 1909 CRITICAL: TypeError: cannot pickle ... It's probable that the error is in your code and not in...
Read more >
Pandas Groupby, TypeError: can't pickle generator object.
But unfortunately, I am getting an error saying TypeError: can't pickle generator object. Kindly advise on how I can resolve this error. Thanks...
Read more >
Why you cannot pickle generators - Alexandre Vassalotti
Now if an object unsupported by pickle (e.g., a file handle, a socket, a database connection, etc) occurs in the local variables of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found