brightmart / text_classification

all kinds of text classification models and more with deep learning
MIT License
7.83k stars 2.57k forks source link

a02_TextCNN: I can't run the p7_TextCNN_model_multilayers.py #87

Closed Amanda2024 closed 5 years ago

Amanda2024 commented 5 years ago

Hello~ Can you teach me how to run it? I have change the textCNN to TextCNNMultilayers in the train.py,,But appeared the error: feed_dict = {TextCNNMultilayers .input_x: trainX[start:end],TextCNNMultilayers .dropout_keep_prob: 0.5,TextCNNMultilayers .iter: iteration,TextCNNMultilayers .tst: not FLAGS.is_training} AttributeError: TextCNNMultilayers instance has no attribute 'iter'

brightmart commented 5 years ago

check the model file to see whether iter exist or not. if not remove TextCNNMultilayers .iter: iteration


发件人: RuanJingqing notifications@github.com 发送时间: 2018年10月25日 11:10 收件人: brightmart/text_classification 抄送: Subscribed 主题: [brightmart/text_classification] a02_TextCNN: I can't run the p7_TextCNN_model_multilayers.py (#87)

Hello~ Can you teach me how to run it? I have change the textCNN to TextCNNMultilayers in the train.py,,But appeared the error: feed_dict = {TextCNNMultilayers .input_x: trainX[start:end],TextCNNMultilayers .dropout_keep_prob: 0.5,TextCNNMultilayers .iter: iteration,TextCNNMultilayers .tst: not FLAGS.is_training} AttributeError: TextCNNMultilayers instance has no attribute 'iter'

― You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/brightmart/text_classification/issues/87, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ASuYMGOLrV3julUlMQwaczf9qbmdJ72Jks5uoSuNgaJpZM4X5aat.

Amanda2024 commented 5 years ago

There must be some errors in TextCNNMultilayers.py. I can't even run the test() in TextCNNMultilayers.py

ValueError: Dimensions must be equal, but are 128 and 1 for 'convolution-pooling-2/conv2' (op: 'Conv2D') with input shapes: [?,4,1,128], [2,128,1,128].

So what should I do ?Thanke you for your reply.

brightmart commented 5 years ago

I remove TextCNNMultilayers.py temporary. if you want to use multi-layer of TextCNN, you can check function of conv_layers_return_2d_great from