nicolas-ivanov / tf_seq2seq_chatbot

[unmaintained]
420 stars 203 forks source link

TypeError: unsupported operand type(s) for /=: 'Tensor' and 'Tensor' #7

Open urjan opened 8 years ago

urjan commented 8 years ago

I get this error message when I try to run train.py:

Traceback (most recent call last): File "train.py", line 15, in <module> tf.app.run() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/default/_app.py", line 11, in run sys.exit(main(sys.argv)) File "train.py", line 12, in main train() File "/home/urja/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/train.py", line 28, in train model = create_model(sess, forward_only=False) File "/home/urja/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/seq2seq_model_utils.py", line 27, in create_model forward_only=forward_only) File "/home/urja/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/seq2seq_model.py", line 149, in __init__ softmax_loss_function=softmax_loss_function) File "build/bdist.linux-x86_64/egg/rnn_enhancement/seq2seq_enhanced.py", line 651, in model_with_buckets File "build/bdist.linux-x86_64/egg/rnn_enhancement/seq2seq_enhanced.py", line 457, in sequence_loss File "build/bdist.linux-x86_64/egg/rnn_enhancement/seq2seq_enhanced.py", line 424, in sequence_loss_by_example TypeError: unsupported operand type(s) for /=: 'Tensor' and 'Tensor'

guduxingzou commented 8 years ago

I have the same problem,someone can help me ???

guduxingzou commented 8 years ago

@urjan Do you solve this problem?

urjan commented 8 years ago

Hi, Upgrading the tensor flow version from 5 to 6 solved it. On May 24, 2016 8:17 AM, "guduxingzou" notifications@github.com wrote:

@urjan https://github.com/urjan Do you solve this problem?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/nicolas-ivanov/tf_seq2seq_chatbot/issues/7#issuecomment-221152669

guduxingzou commented 8 years ago

@urjan thanks very much !

urjan commented 8 years ago

So, do you have your training script running? On May 24, 2016 5:14 PM, "guduxingzou" notifications@github.com wrote:

@urjan https://github.com/urjan thanks very much !

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/nicolas-ivanov/tf_seq2seq_chatbot/issues/7#issuecomment-221244013

guduxingzou commented 8 years ago

@urjan no! I find new problem! 如下: Created model with fresh parameters. Traceback (most recent call last): File "train.py", line 15, in tf.app.run() File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/default/_app.py", line 30, in run sys.exit(main(sys.argv)) File "train.py", line 12, in main train() File "/home/yuzp/pythonproject/tensflow/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/train.py", line 28, in train model = create_model(sess, forward_only=False) File "/home/yuzp/pythonproject/tensflow/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/seq2seq_model_utils.py", line 35, in create_model session.run(tf.initialize_all_variables()) File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 368, in run results = self._do_run(target_list, unique_fetch_targets, feed_dict_string) File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 444, in _do_run e.code) tensorflow.python.framework.errors.InvalidArgumentError: Cannot assign a device to node 'embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell3/GRUCell/Candidate/Linear/Bias': Could not satisfy explicit device specification '/gpu:3' [[Node: embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell3/GRUCell/Candidate/Linear/Bias = Variable[container="", dtype=DT_FLOAT, shape=[2048], shared_name="", _device="/gpu:3"]()]] Caused by op u'embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell3/GRUCell/Candidate/Linear/Bias', defined at: File "train.py", line 15, in tf.app.run() File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/default/_app.py", line 30, in run sys.exit(main(sys.argv)) File "train.py", line 12, in main train() File "/home/yuzp/pythonproject/tensflow/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/train.py", line 28, in train model = create_model(sess, forward_only=False) File "/home/yuzp/pythonproject/tensflow/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/seq2seq_model_utils.py", line 27, in create_model forward_only=forward_only) File "/home/yuzp/pythonproject/tensflow/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/seq2seq_model.py", line 149, in init softmax_loss_function=softmax_loss_function) File "build/bdist.linux-x86_64/egg/rnn_enhancement/seq2seq_enhanced.py", line 630, in model_with_buckets bucket_decoder_inputs) #nick pay attention here -- you added bucket_states File "/home/yuzp/pythonproject/tensflow/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/seq2seq_model.py", line 148, in lambda x, y: seq2seq_f(x, y, False), File "/home/yuzp/pythonproject/tensflow/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/seq2seq_model.py", line 112, in seq2seq_f feed_previous=do_decode) File "build/bdist.linux-x86_64/egg/rnn_enhancement/seq2seq_enhanced.py", line 341, in embedding_attention_seq2seq temperature_decode = temperature_decode, temperature = temperature) File "build/bdist.linux-x86_64/egg/rnn_enhancement/seq2seq_enhanced.py", line 259, in embedding_attention_decoder temperature = temperature) File "build/bdist.linux-x86_64/egg/rnn_enhancement/seq2seq_enhanced.py", line 159, in attention_decoder cell_output, new_state = cell(x, hidden_state_input) #nick, changed this to your hidden state input File "build/bdist.linux-x86_64/egg/rnn_enhancement/rnn_cell_enhanced.py", line 1149, in call cur_inp, new_state = cell(cur_inp, cur_state) #this replaces cur_inp to a differen input File "build/bdist.linux-x86_64/egg/rnn_enhancement/rnn_cell_enhanced.py", line 520, in call c = tf.tanh(linear.linear([inputs, r * state], self._num_units, True)) File "build/bdist.linux-x86_64/egg/rnn_enhancement/linear_enhanced.py", line 68, in linear initializer=tf.constant_initializer(bias_start)) File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 242, in get_variable trainable, collections) File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 175, in get_variable self.reuse, trainable, collections) File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 119, in get_variable collections=collections) File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variables.py", line 210, in init name=name) File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/state_ops.py", line 116, in variable_op container=container, shared_name=shared_name) File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/gen_state_ops.py", line 334, in _variable name=name) File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/op_def_library.py", line 664, in apply_op op_def=op_def) File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1834, in create_op original_op=self._default_original_op, op_def=op_def) File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1043, in init self._traceback = _extract_stack()

guduxingzou commented 8 years ago

@urjan tensorflow.python.framework.errors.InvalidArgumentError: Cannot assign a device to node 'embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell3/GRUCell/Candidate/Linear/Bias': Could not satisfy explicit device specification '/gpu:3'