Skip to content

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

Description

@VibhuSrivastava

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions