Closed weizhenzhao closed 6 years ago
请确认tensorflow的版本和python的版本,如果版本正确的话应该是不会有问题的
@weizhenzhao ping.
@weizhenzhao 你试试把output = tf.reshape(tf.concat(1, outputs), [-1, HIDDEN_SIZE]) 改为 output = tf.reshape(tf.concat(outputs, 1), [-1, HIDDEN_SIZE])
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
Prevent issues from auto-closing with an /lifecycle frozen
comment.
If this issue is safe to close now please do so with /close
.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten
.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close
.
/lifecycle rotten /remove-lifecycle stale
Traceback (most recent call last): File "C:\Users\weizhen\workspace\TextUtil\LanguageModel.py", line 159, in
tf.app.run()
File "C:\Users\weizhen\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "C:\Users\weizhen\workspace\TextUtil\LanguageModel.py", line 135, in main
train_model = PTBModel(True, TRAIN_BATCH_SIZE, TRAIN_NUM_STEP)
File "C:\Users\weizhen\workspace\TextUtil\LanguageModel.py", line 69, in init
cell_output, state = cell(inputs[:, time_step, :], state)
File "C:\Users\weizhen\AppData\Local\Programs\Python\Python35\lib\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 "C:\Users\weizhen\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\contrib\rnn\python\ops\core_rnn_cell_impl.py", line 713, in call
output, new_state = self._cell(inputs, state, scope)
File "C:\Users\weizhen\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\contrib\rnn\python\ops\core_rnn_cell_impl.py", line 235, in call
with _checked_scope(self, scope or "basic_lstm_cell", reuse=self._reuse):
File "C:\Users\weizhen\AppData\Local\Programs\Python\Python35\lib\contextlib.py", line 59, in enter
return next(self.gen)
File "C:\Users\weizhen\AppData\Local\Programs\Python\Python35\lib\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.BasicLSTMCell object at 0x00000215F1A63B00> with a different variable scope than its first use. First use of cell was with scope 'language_model/RNN/multi_rnn_cell/cell_0/basic_lstm_cell', this attempt is with scope 'language_model/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(...)] * numlayers), 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.)