richliao / textClassifier

Text classifier for Hierarchical Attention Networks for Document Classification
Apache License 2.0
1.07k stars 379 forks source link

Hatt error #18

Closed 978749951 closed 6 years ago

978749951 commented 6 years ago

Training is fine. however I got a error after training, I don't know how to solve it. Anyone could share me a hand? Epoch 10/10 21054/21054 [==============================] - 257s - loss: 0.3286 - acc: 0.8863 - val_loss: 0.3596 - val_acc: 0.8643

Traceback (most recent call last): File "Hatt_modify.py", line 231, in l_dense_sent = TimeDistributed(Dense(200))(l_lstm_sent) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 586, in call self.assert_input_compatibility(inputs) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 457, in assert_input_compatibility str(K.ndim(x))) ValueError: Input 0 is incompatible with layer time_distributed_4: expected ndim=3, found ndim=4

978749951 commented 6 years ago

I have solved it. The reason why the error occurs was that the program should run in Keras 1.X instead of keras 2.x. If you encounter the similar problems, you can refer to it.