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

Using a tf.Tensor as a Python bool is not allowed #11

Open
VibhuSrivastava opened this issue Jun 23, 2016 · 1 comment
Open

Using a tf.Tensor as a Python bool is not allowed #11

VibhuSrivastava opened this issue Jun 23, 2016 · 1 comment

Comments

@VibhuSrivastava
Copy link

When training the model by running the train.py command, I encounter the following issue:

python train.py
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally
You are using the decoding_enhanced library!
Initializer Library -- Will add to this if necessary.
Unitary Linear has been imported
Preparing dialog data in /var/lib/tf_seq2seq_chatbot/data
E tensorflow/stream_executor/cuda/cuda_driver.cc:491] failed call to cuInit: CUDA_ERROR_NO_DEVICE
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:140] kernel driver does not appear to be running on this host (instance-1): /proc/driver/nvidia/version does not exist
I tensorflow/core/common_runtime/gpu/gpu_init.cc:81] No GPU devices available on machine.
Creating 4 layers of 2048 units.
Traceback (most recent call last):
host (instance-1): /proc/driver/nvidia/version does not exist
File "train.py", line 15, in
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 30, in run
sys.exit(main(sys.argv))
File "train.py", line 12, in main
train()
File "/home/vibhu_vandita/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/train.py", line 28, in train
model = create_model(sess, forward_only=False)
File "/home/vibhu_vandita/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/seq2seq_model_utils.py", line 27, in cre
ate_model
forward_only=forward_only)
File "/home/vibhu_vandita/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 629, in model_with_buckets
File "/home/vibhu_vandita/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/seq2seq_model.py", line 148, in
lambda x, y: seq2seq_f(x, y, False),
File "/home/vibhu_vandita/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_se
q2seq
File "build/bdist.linux-x86_64/egg/rnn_enhancement/seq2seq_enhanced.py", line 259, in embedding_attention_de
coder
File "build/bdist.linux-x86_64/egg/rnn_enhancement/seq2seq_enhanced.py", line 165, in attention_decoder
File "build/bdist.linux-x86_64/egg/rnn_enhancement/seq2seq_enhanced.py", line 112, in attention
File "build/bdist.linux-x86_64/egg/rnn_enhancement/linear_enhanced.py", line 42, in linear
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 528, in nonzero
raise TypeError("Using a tf.Tensor as a Python bool is not allowed. "
TypeError: Using a tf.Tensor as a Python bool is not allowed. Use if t is not None: instead of if t: to test if a tensor is defined, and use the logical TensorFlow ops to test the value of a tensor.

What can be done in order to resolve this issue?

@maeda
Copy link

maeda commented Oct 29, 2016

I don't know exactly why, but when you comment or remove that validation (https://github.com/nicolas-ivanov/Seq2Seq_Upgrade_TensorFlow/blob/master/rnn_enhancement/linear_enhanced.py#L44), this error not happen anymore.

I'm just testing this code, so I won't invest more time to investigate the reason. Anyway, I'm sharing to unblock you.

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

2 participants