/tutorials/rnn/translate/translate.py throws TypeError: can't pickle _thread.lock objects
System information
- What is the top-level directory of the model you are using: models/tutorials/rnn/translate/
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
- TensorFlow installed from (source or binary): Pip install
- TensorFlow version (use command below): 1.2.0
- Bazel version (if compiling from source): n/a
- CUDA/cuDNN version: Not GPU
- GPU model and memory: Not GPU
- Exact command to reproduce: Run translate.py
Describe the problem
When I run translate.py, it loads all the data from the internet on first run, then creates 3 layers of 1024 units, then crashes with the log below. I believe the issue lies with having a list of buckets with len > 1.
Source code / logs
https://pastebin.com/5PQeXx0J Stack-Overflow with more details: https://stackoverflow.com/questions/44855603/typeerror-cant-pickle-thread-lock-objects-in-seq2seq
I ran into the same problem on my MacBook Pro, I thought perhaps there were some bugs in the new version 1.2.0, so I switched to Tensorflow 1.0.0 version and it worked. Will anybody give any clues to solve it?
I'm having the same issue.
@panyx0718, any thoughts on this?
@ali01 Update: I actually get the issue on my own project too. It appears to only occur when a bucket of length > 1 is fed to the model ([100, 100), (200, 200)] fails while ([100, 100]) works fine.
For more details, I linked the Stackoverflow in the main issue post.
Well, I created a virtual environment by conda prompt on my Mac, installed python3.6 and tensorflow 1.0.0 along with kernel. Then I switched to tensorflow 1.0.0 kernel in my jupyter notebook.
try to delete the file named 'pycache' in your python workspace , i have the same problem and fixed in this way
I get the same problem as OP, also get the exact same error log.
I'm also running Windows 10, and have tried both with and without gpu support on Tensorflow 1.2.0.
I get it to work if I change the list of buckets (_bucket) to length 1 and makes sure the __pycache__ folder is deleted (if I've done any failing runs before)
also i have the same issue.
same problem ...
@DongjunLee @guotong1988
Try the answer suggested on StackOverflow:
setattr(tf.contrib.rnn.GRUCell, '__deepcopy__', lambda self, _: self)
setattr(tf.contrib.rnn.BasicLSTMCell, '__deepcopy__', lambda self, _: self)
setattr(tf.contrib.rnn.MultiRNNCell, '__deepcopy__', lambda self, _: self)