Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when running Tensorflow Sequence to Sequence Tutorial

I am getting the following error message when following the instructions in the Sequence to Sequence tutorial: https://www.tensorflow.org/tutorials/seq2seq

When I run

python translate.py --data-dir [your data directory]

I eventually get the following error when the script is creating the layers:

AttributeError: 'NoneType' object has no attribute 'update'

(Full stack trace below)

System info:

  • macOS 10.12.5
  • Python 3.5.3
  • Tensorflow 1.2.0
  • Tensorflow installed via pip (9.0.1) within conda (4.3.21)

Also, the WMT data has been downloaded and processed. I downloaded the English to French data as specified in the tutorial.

Any help would be greatly appreciated.

Preparing WMT data in /tmp
2017-06-16 09:28:44.185353: 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-06-16 09:28:44.185383: 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-06-16 09:28:44.185388: 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-06-16 09:28:44.185393: 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 1024 units.
Traceback (most recent call last):
 File "translate.py", line 322, in <module>
   tf.app.run()
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 48, in run
   _sys.exit(main(_sys.argv[:1] + flags_passthrough))
 File "translate.py", line 319, in main
   train()
 File "translate.py", line 178, in train
   model = create_model(sess, False)
 File "translate.py", line 136, in create_model
   dtype=dtype)
 File "/Users/<redacted>/models/tutorials/rnn/translate/seq2seq_model.py", line 179, in __init__
   softmax_loss_function=softmax_loss_function)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/site-packages/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py", line 1206, in model_with_buckets
   decoder_inputs[:bucket[1]])
 File "/Users/<redacted>/models/tutorials/rnn/translate/seq2seq_model.py", line 178, in <lambda>
  lambda x, y: seq2seq_f(x, y, False),
 File "/Users/<redacted>/models/tutorials/rnn/translate/seq2seq_model.py", line 142, in seq2seq_f
  dtype=dtype)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/site-packages/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py", line 848, in embedding_attention_seq2seq
  encoder_cell = copy.deepcopy(cell)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 166, in deepcopy
  y = copier(memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/site-packages/tensorflow/python/layers/base.py", line 476, in __deepcopy__
  setattr(result, k, copy.deepcopy(v, memo))
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 155, in deepcopy
  y = copier(x, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 218, in _deepcopy_list
  y.append(deepcopy(a, memo))
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 182, in deepcopy
  y = _reconstruct(x, rv, 1, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 297, in _reconstruct
  state = deepcopy(state, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 155, in deepcopy
  y = copier(x, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 243, in _deepcopy_dict
  y[deepcopy(key, memo)] = deepcopy(value, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 182, in deepcopy
  y = _reconstruct(x, rv, 1, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 297, in _reconstruct
  state = deepcopy(state, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 155, in deepcopy
  y = copier(x, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 243, in _deepcopy_dict
  y[deepcopy(key, memo)] = deepcopy(value, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 155, in deepcopy
  y = copier(x, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 218, in _deepcopy_list
  y.append(deepcopy(a, memo))
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 182, in deepcopy
  y = _reconstruct(x, rv, 1, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 297, in _reconstruct
  state = deepcopy(state, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 155, in deepcopy
  y = copier(x, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 243, in _deepcopy_dict
  y[deepcopy(key, memo)] = deepcopy(value, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 155, in deepcopy
  y = copier(x, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 218, in _deepcopy_list
  y.append(deepcopy(a, memo))
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 155, in deepcopy
  y = copier(x, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 223, in _deepcopy_tuple
  y = [deepcopy(a, memo) for a in x]
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 223, in <listcomp>
  y = [deepcopy(a, memo) for a in x]
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 155, in deepcopy
  y = copier(x, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 243, in _deepcopy_dict
  y[deepcopy(key, memo)] = deepcopy(value, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 182, in deepcopy
  y = _reconstruct(x, rv, 1, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 297, in _reconstruct
  state = deepcopy(state, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 155, in deepcopy
  y = copier(x, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 243, in _deepcopy_dict
  y[deepcopy(key, memo)] = deepcopy(value, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 182, in deepcopy
  y = _reconstruct(x, rv, 1, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 297, in _reconstruct
  state = deepcopy(state, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 155, in deepcopy
  y = copier(x, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 243, in _deepcopy_dict
  y[deepcopy(key, memo)] = deepcopy(value, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 182, in deepcopy
  y = _reconstruct(x, rv, 1, memo)
 File "/Users/<redacted>/anaconda/envs/tf/lib/python3.5/copy.py", line 306, in _reconstruct
  y.__dict__.update(state)
AttributeError: 'NoneType' object has no attribute 'update'
like image 720
composer314 Avatar asked Feb 04 '23 06:02

composer314


1 Answers

There seems to be a problem with deepcopy of RNNCell, we're tracking it in this github bug: https://github.com/tensorflow/tensorflow/issues/8191

On a separate note, there is a new TensorFlow seq2seq repo with many models here: https://github.com/google/seq2seq and if you're just interested in the result and not the model, then we have new models here: https://github.com/tensorflow/tensor2tensor Sorry for the bug in any case, please check on the github bug page for more details on the solution.

like image 61
Lukasz Kaiser Avatar answered Feb 06 '23 18:02

Lukasz Kaiser