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

tensorflow 1 migration #8

Open jiberi opened 7 years ago

jiberi commented 7 years ago

Migration to tensorflow 1 I changed the concat from (1,xxx) to (xxx,1) I changed the tf.nn.rnn_ to tf.contrib.rnn

But now I have this error in 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 "/home/administrator/django/demo/tempo/multi-class-text-classification-cnn-rnn/text_cnnrnn.py", line 58, in init inputs = [tf.squeeze(input, [1]) for input_ in tf.split(1, reduced, pooled_concat)] File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/array_ops.py", line 1203, in split num = size_splits_shape.dims[0] IndexError: list index out of range

Any ideas?

ushagayatri commented 7 years ago

Are you able to solve this error? Please reply

ushagayatri commented 7 years ago

1) I did this change in line 85 of text_cnn_rnn.py losses = tf.nn.softmax_cross_entropy_with_logits(labels = self.input_y, logits = self.scores) # only named arguments accepted

2) i also changed concat from (1,xxx) to (xxx,1)

Please help with necessary changes.

Jason2031 commented 7 years ago

Same problem here, looking forward to the solution... I'm new to NN, but in desperate need of NN in my project...