jiegzhan / multi-class-text-classification-cnn-rnn

Classify Kaggle San Francisco Crime Description into 39 classes. Build the model with CNN, RNN (GRU and LSTM) and Word Embeddings on Tensorflow.
https://www.kaggle.com/c/sf-crime/data
Apache License 2.0
599 stars 262 forks source link

While Training getting error #4

Open kumarneeraj2005 opened 7 years ago

kumarneeraj2005 commented 7 years ago

[root@bdl02node04 multi-class-text-classification-cnn-rnn-master]# python train.py CRITICAL:root:The maximum length is 14 INFO:root:x_train: 711219, x_dev: 79025, x_test: 87805 INFO:root:y_train: 711219, y_dev: 79025, y_test: 87805 W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. Traceback (most recent call last): File "train.py", line 161, in train_cnn_rnn() File "train.py", line 60, in train_cnn_rnn l2_reg_lambda = params['l2_reg_lambda']) File "/root/NN/multi-class-text-classification-cnn-rnn-master/text_cnn_rnn.py", line 34, in init pad_prio = tf.concat(1, [self.pad] * num_prio) File "/root/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1047, in concat dtype=dtypes.int32).get_shape( File "/root/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 651, in convert_to_tensor as_ref=False) File "/root/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 716, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "/root/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 176, in _constant_tensor_conversion_function return constant(v, dtype=dtype, name=name) File "/root/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 165, in constant tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape)) File "/root/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 367, in make_tensor_proto _AssertCompatible(values, dtype) File "/root/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible (dtype.name, repr(mismatch), type(mismatch).name)) TypeError: Expected int32, got list containing Tensors of type '_Message' instead.

jiegzhan commented 7 years ago

Which version of Tensorflow are you using?

I was using Tensorflow 0.9 when I built this project.

akshataph commented 7 years ago

even i am getting same error while training i am using 1.0 tensorflow version

akshataph commented 7 years ago

i changed tensorflow to 0.90 version it worked for me thanks...

ushagayatri commented 7 years ago

How did you change tensorflow to 0.90? Please reply. Also Please suggest what are the changes i need to make if i have to run this with tensorflow 1.

kumarneeraj2005 commented 7 years ago

@ushagayatri follow below steps to install Tensor-flow 0.9 on Ubuntu export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/tensorflow-0.9.0rc0-py2-none-any.whl

sudo pip install –upgrade $TF_BINARY_URL

ushagayatri commented 7 years ago

@kumarneeraj2005 i have both python 2.7 and 3 running on my mac. So when i executed the above tensor flow in python 2.7 got updated to 0.9 version. So it did not work. I wonder how do i do with python3. Can you please suggest.

i tried python3 -m pip install –upgrade $TF_BINARY_URL

ushagayatri commented 7 years ago

@kumarneeraj2005 , @jiegzhan , @akshataph

I got the below error when i executed in python 2.7 as python train.py ./data/train.csv.zip ./training_config.json. Please suggest.

nagas-MacBook-Pro:tf0.9 nagaushagayathrilokala$ python train.py ./data/train.csv.zip ./training_config.json CRITICAL:root:The maximum length is 14 INFO:root:x_train: 711219, x_dev: 79025, x_test: 87805 INFO:root:y_train: 711219, y_dev: 79025, y_test: 87805 Traceback (most recent call last): File "train.py", line 161, in train_cnn_rnn() File "train.py", line 60, in train_cnn_rnn l2_reg_lambda = params['l2_reg_lambda']) File "/Users/nagaushagayathrilokala/Desktop/tf0.9/text_cnn_rnn.py", line 34, in init pad_prio = tf.concat([self.pad] * num_prio, 1) File "/Users/nagaushagayathrilokala/anaconda/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 458, in concat dtype=dtypes.int32).get_shape( File "/Users/nagaushagayathrilokala/anaconda/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 620, in convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "/Users/nagaushagayathrilokala/anaconda/lib/python2.7/site-packages/tensorflow/python/ops/constant_op.py", line 179, in _constant_tensor_conversion_function return constant(v, dtype=dtype, name=name) File "/Users/nagaushagayathrilokala/anaconda/lib/python2.7/site-packages/tensorflow/python/ops/constant_op.py", line 162, in constant tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape)) File "/Users/nagaushagayathrilokala/anaconda/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 353, in make_tensor_proto _AssertCompatible(values, dtype) File "/Users/nagaushagayathrilokala/anaconda/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 290, in _AssertCompatible (dtype.name, repr(mismatch), type(mismatch).name)) TypeError: Expected int32, got list containing Tensors of type '_Message' instead.

ushagayatri commented 7 years ago

@kumarneeraj2005 @jiegzhan

I tried this: export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/tensorflow-0.9.0rc0-py3-none-any.whl python3 -m pip install $TF_BINARY_URL

This installed tensorflow 0.9 in python3. But still i get this error

CRITICAL:root:The maximum length is 14 INFO:root:x_train: 711219, x_dev: 79025, x_test: 87805 INFO:root:y_train: 711219, y_dev: 79025, y_test: 87805 Traceback (most recent call last): File "train.py", line 161, in train_cnn_rnn() File "train.py", line 60, in train_cnn_rnn l2_reg_lambda = params['l2_reg_lambda']) File "/Users/nagaushagayathrilokala/Desktop/tf0.9/text_cnn_rnn.py", line 34, in init pad_prio = tf.concat([self.pad] * num_prio, 1) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 458, in concat dtype=dtypes.int32).get_shape( File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 620, in convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/ops/constant_op.py", line 179, in _constant_tensor_conversion_function return constant(v, dtype=dtype, name=name) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/ops/constant_op.py", line 162, in constant tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape)) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 353, in make_tensor_proto _AssertCompatible(values, dtype) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 290, in _AssertCompatible (dtype.name, repr(mismatch), type(mismatch).name)) TypeError: Expected int32, got list containing Tensors of type '_Message' instead.

SidrahJunaid commented 7 years ago

Im also getting the same error im using python 3.4 and tensorflow=0.9

553270311 commented 5 years ago

how can i predict the result