models icon indicating copy to clipboard operation
models copied to clipboard

/tutorials/rnn/translate/translate.py throws TypeError: can't pickle _thread.lock objects

Open ghost opened this issue 9 years ago • 10 comments

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

ghost avatar Jun 28 '17 01:06 ghost

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?

richardsun-voyager avatar Jun 28 '17 07:06 richardsun-voyager

I'm having the same issue.

matteo-brucato avatar Jun 30 '17 19:06 matteo-brucato

@panyx0718, any thoughts on this?

alive-zk avatar Jun 30 '17 21:06 alive-zk

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

ghost avatar Jun 30 '17 22:06 ghost

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.

richardsun-voyager avatar Jul 01 '17 01:07 richardsun-voyager

try to delete the file named 'pycache' in your python workspace , i have the same problem and fixed in this way

dxteam2024 avatar Jul 23 '17 06:07 dxteam2024

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)

Jacobh2 avatar Jul 29 '17 17:07 Jacobh2

also i have the same issue.

DongjunLee avatar Sep 11 '17 14:09 DongjunLee

same problem ...

guotong1988 avatar Nov 30 '17 11:11 guotong1988

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

maxim5 avatar Jan 28 '18 11:01 maxim5