0

See the value error at the end of the code block. This error occurred while running the translate tutorial. Any ideas why this broke? I'm running python3 with CUDA and CuDNN properly installed. And I was able to verify the installation of TensorFlow according to the installation directions, so CuDNN/CUDA's basic functionality should be working. I'm using python3 on Ubuntu 16.04.

Have others using the translate tutorial recently had this issue? Do you know why I'm having I'm having this issue when I assume this tutorial is working for others?

`(tensorflow) nathan@nathan1:~/repos/tensorflow/models/tutorials/rnn/translate$ python3 translate.py --data_dir ~/data/tensorflow/translate/

Preparing WMT data in /home/nathan/data/tensorflow/translate/
2017-05-16 22:18:50.664841: 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-16 22:18:50.664859: 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-16 22:18:50.664864: 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-16 22:18:50.664868: 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-16 22:18:50.664872: 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.
2017-05-16 22:18:50.665996: E tensorflow/stream_executor/cuda/cuda_driver.cc:405] failed call to cuInit: CUDA_ERROR_UNKNOWN
2017-05-16 22:18:50.666149: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:158] retrieving CUDA diagnostic information for host: nathan1
2017-05-16 22:18:50.666157: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:165] hostname: nathan1
2017-05-16 22:18:50.666177: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:189] libcuda reported version is: 375.66.0
2017-05-16 22:18:50.666323: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:369] driver version file contents: """NVRM version: NVIDIA UNIX x86_64 Kernel Module  375.66  Mon May  1 15:29:16 PDT 2017
GCC version:  gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 
"""
2017-05-16 22:18:50.666338: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:193] kernel reported version is: 375.66.0
2017-05-16 22:18:50.666343: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:300] kernel version seems to match DSO: 375.66.0
Creating 3 layers of 1024 units.
Traceback (most recent call last):
  File "translate.py", line 322, in <module>
    tf.app.run()
  File "/home/nathan/.local/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 "/home/nathan/repos/tensorflow/models/tutorials/rnn/translate/seq2seq_model.py", line 179, in __init__
    softmax_loss_function=softmax_loss_function)
  File "/home/nathan/.local/lib/python3.5/site-packages/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py", line 1201, in model_with_buckets
    decoder_inputs[:bucket[1]])
  File "/home/nathan/repos/tensorflow/models/tutorials/rnn/translate/seq2seq_model.py", line 178, in <lambda>
    lambda x, y: seq2seq_f(x, y, False),
  File "/home/nathan/repos/tensorflow/models/tutorials/rnn/translate/seq2seq_model.py", line 142, in seq2seq_f
    dtype=dtype)
  File "/home/nathan/.local/lib/python3.5/site-packages/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py", line 855, in embedding_attention_seq2seq
    encoder_cell, encoder_inputs, dtype=dtype)
  File "/home/nathan/.local/lib/python3.5/site-packages/tensorflow/contrib/rnn/python/ops/core_rnn.py", line 197, in static_rnn
    (output, state) = call_cell()
  File "/home/nathan/.local/lib/python3.5/site-packages/tensorflow/contrib/rnn/python/ops/core_rnn.py", line 184, in <lambda>
    call_cell = lambda: cell(input_, state)
  File "/home/nathan/.local/lib/python3.5/site-packages/tensorflow/contrib/rnn/python/ops/core_rnn_cell_impl.py", line 881, in __call__
    return self._cell(embedded, state)
  File "/home/nathan/.local/lib/python3.5/site-packages/tensorflow/contrib/rnn/python/ops/core_rnn_cell_impl.py", line 953, in __call__
    cur_inp, new_state = cell(cur_inp, cur_state)
  File "/home/nathan/.local/lib/python3.5/site-packages/tensorflow/contrib/rnn/python/ops/core_rnn_cell_impl.py", line 146, in __call__
    with _checked_scope(self, scope or "gru_cell", reuse=self._reuse):
  File "/usr/lib/python3.5/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/home/nathan/.local/lib/python3.5/site-packages/tensorflow/contrib/rnn/python/ops/core_rnn_cell_impl.py", line 77, in _checked_scope
    type(cell).__name__))
ValueError: Attempt to reuse RNNCell <tensorflow.contrib.rnn.python.ops.core_rnn_cell_impl.GRUCell object at 0x7f0b66e04b70> with a different variable scope than its first use.  First use of cell was with scope 'embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/multi_rnn_cell/cell_0/gru_cell', this attempt is with scope 'embedding_attention_seq2seq/rnn/multi_rnn_cell/cell_0/gru_cell'.  Please create a new instance of the cell if you would like it to use a different set of weights.  If before you were using: MultiRNNCell([GRUCell(...)] * num_layers), change to: MultiRNNCell([GRUCell(...) for _ in range(num_layers)]).  If before you were using the same cell instance as both the forward and reverse cell of a bidirectional RNN, simply create two instances (one for forward, one for reverse).  In May 2017, we will start transitioning this cell's behavior to use existing stored weights, if any, when it is called with scope=None (which can lead to silent model degradation, so this error will remain until then.` 
talonmies
  • 70,661
  • 34
  • 192
  • 269
Nathaniel Powell
  • 255
  • 3
  • 11

1 Answers1

1

This issue is because of the updating of tensorflow itself. In the recent update, tensorflow didn't allow to reuse the rnn cells which was allowed before.

rnn_cell = tf.contrib.rnn.LSTMCell(300)

output, _ = tf.nn.bidirectional_dynamic_rnn(rnn_cell, rnn_cell, data, dtype = tf.float32)

#^^^^allowed before but not now

fw_rnn_cell = tf.contrib.rnn.LSTMCell(300)
bw_rnn_cell = tf.contrib.rnn.LSTMCell(300)
output, _ = tf.nn.bidirectional_dynamic_rnn(fw_rnn_cell, bw_rnn_cell, data, dtype = tf.float32)

#^^^^allowed now

#Another example

rnn_cell = tf.contrib.rnn.LSTMCell(300)
output_layer_1, _ = tf.nn.dynamic_rnn(rnn_cell, data, dtype = tf.float32, scope = "rnn_layer_1")
output_layer_2, _ = tf.nn.dynamic_rnn(rnn_cell, output_layer_1, dtype = tf.float32, scope = "rnn_layer_2")

#^^^^allowed before but not now

rnn_cell_1 = tf.contrib.rnn.LSTMCell(300)
output_layer_1, _ = tf.nn.dynamic_rnn(rnn_cell_1, data, dtype = tf.float32, scope = "rnn_layer_1")
rnn_cell_2 = tf.contrib.rnn.LSTMCell(300)
output_layer_2, _ = tf.nn.dynamic_rnn(rnn_cell_2, output_layer_1, dtype = tf.float32, scope = "rnn_layer_2")

#^^^^allowed now

So what can you do? You can choose:

  1. change to another newer tutorial

  2. fix the code by yourself

  3. use an old version tensorflow

Sraw
  • 18,892
  • 11
  • 54
  • 87