llSourcell / tensorflow_chatbot

Tensorflow chatbot demo by @Sirajology on Youtube
1.45k stars 806 forks source link

TypeError: can't pickle _thread.lock objects #41

Closed quest4next closed 7 years ago

quest4next commented 7 years ago

python3 execute.py

Mode : train

Preparing data in working_dir/ 2017-05-21 11:54:31.378451: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. 2017-05-21 11:54:31.378491: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. 2017-05-21 11:54:31.378507: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2017-05-21 11:54:31.378523: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. 2017-05-21 11:54:31.378539: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations. Creating 3 layers of 256 units. Traceback (most recent call last): File "execute.py", line 324, in train() File "execute.py", line 142, in train model = create_model(sess, False) File "execute.py", line 109, in create_model model = seq2seq_model.Seq2SeqModel( gConfig['enc_vocab_size'], gConfig['dec_vocab_size'], _buckets, gConfig['layer_size'], gConfig['num_layers'], gConfig['max_gradient_norm'], gConfig['batch_size'], gConfig['learning_rate'], gConfig['learning_rate_decay_factor'], forward_only=forward_only) File "/mnt/newvolume/tensorflow_home/jupyter-notebooks_backup/tensorflow_chatbot-master/seq2seq_model.py", line 161, in init lambda x, y: seq2seq_f(x, y, False)) File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py", line 849, in embedding_attention_seq2seq encoder_cell = copy.deepcopy(cell) File "/usr/lib/python3.5/copy.py", line 155, in deepcopy y = copier(x, memo) File "/usr/lib/python3.5/copy.py", line 218, in _deepcopy_list y.append(deepcopy(a, memo)) File "/usr/lib/python3.5/copy.py", line 182, in deepcopy y = _reconstruct(x, rv, 1, memo) File "/usr/lib/python3.5/copy.py", line 297, in _reconstruct state = deepcopy(state, memo) File "/usr/lib/python3.5/copy.py", line 155, in deepcopy y = copier(x, memo) File "/usr/lib/python3.5/copy.py", line 243, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) File "/usr/lib/python3.5/copy.py", line 182, in deepcopy y = _reconstruct(x, rv, 1, memo) File "/usr/lib/python3.5/copy.py", line 297, in _reconstruct state = deepcopy(state, memo) File "/usr/lib/python3.5/copy.py", line 155, in deepcopy y = copier(x, memo) File "/usr/lib/python3.5/copy.py", line 243, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) File "/usr/lib/python3.5/copy.py", line 182, in deepcopy y = _reconstruct(x, rv, 1, memo) File "/usr/lib/python3.5/copy.py", line 297, in _reconstruct state = deepcopy(state, memo) File "/usr/lib/python3.5/copy.py", line 155, in deepcopy y = copier(x, memo) File "/usr/lib/python3.5/copy.py", line 243, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) File "/usr/lib/python3.5/copy.py", line 174, in deepcopy rv = reductor(4) TypeError: can't pickle _thread.lock objects

quest4next commented 7 years ago

solved!

lvandam commented 7 years ago

@quest4next How did you solve this issue?

quest4next commented 7 years ago

@lvandam as far as I remember, after deleting the .pyc files in pycache folder it worked for me. Give it a try..

ghost commented 7 years ago

Clarification: The pycache folder can be found in the project directory. Just delete all the files.

ghost commented 7 years ago

@quest4next This did not solve my problem.

SeekPoint commented 7 years ago

this doesn't work on my case@ @quest4next

arjunjamwal commented 7 years ago

Any update or a workaround for the above error?

maxim5 commented 6 years ago

See this answer on StackOverflow. Basically, the workaround is this:

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)