Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lab-12-4-rnn_long_char ValueError #142

Closed
JAICHANGPARK opened this issue Apr 30, 2017 · 4 comments
Closed

lab-12-4-rnn_long_char ValueError #142

JAICHANGPARK opened this issue Apr 30, 2017 · 4 comments

Comments

@JAICHANGPARK
Copy link

outputs, _states = tf.nn.dynamic_rnn(cell, X_one_hot, dtype=tf.float32)
X_for_fc = tf.reshape(outputs, [-1, hidden_size])
outputs = tf.contrib.layers.fully_connected(X_for_fc, num_classes, activation_fn=None)
outputs = tf.reshape(outputs, [batch_size, sequence_length, num_classes])

ValueError: Attempt to reuse RNNCell <tensorflow.contrib.rnn.python.ops.core_rnn_cell_impl.BasicLSTMCell object at 0x00000256226FEC50> with a different variable scope than its first use. First use of cell was with scope 'rnn/multi_rnn_cell/cell_0/basic_lstm_cell', this attempt is with scope 'rnn/multi_rnn_cell/cell_1/basic_lstm_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([BasicLSTMCell(...)] * num_layers), change to: MultiRNNCell([BasicLSTMCell(...) 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.)

@JAICHANGPARK
Copy link
Author

ValueError: Attempt to have a second RNNCell use the weights of a variable scope that already has weights: 'rnn/multi_rnn_cell/cell_0/basic_lstm_cell'; and the cell was not constructed as BasicLSTMCell(..., reuse=True). To share the weights of an RNNCell, simply reuse it in your second calculation, or create a new one with the argument reuse=True.

@kkweon
Copy link
Collaborator

kkweon commented Apr 30, 2017

fff

I'm not able to reproduce this error.

What is your tensorflow version? tested on OSX & Linux with tf.version 1.0.1

python -c "import tensorflow; print(tensorflow.__version__)"

@hunkim
Copy link
Owner

hunkim commented May 4, 2017

I also cannot reproduce. Please let me know.

@JAICHANGPARK are you running this on Jupiter notebook?

@hunkim hunkim closed this as completed May 4, 2017
@antil1
Copy link
Contributor

antil1 commented May 17, 2017

This error occur on google cloud platform. (Ubuntu 16.04LTS, Tensorflow(1.1.0))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants