brightmart / ai_law

all kinds of baseline models for long text classificaiton( text categorization)
280 stars 77 forks source link

train and predictor #4

Closed tangdouer closed 6 years ago

tangdouer commented 6 years ago

train: tf.app.flags.DEFINE_string("ckpt_dir","./predictor/checkpoint/","checkpoint location for the model") tf.app.flags.DEFINE_string("model","text_cnn","name of model:han,text_cnn,dp_cnn,c_gru,c_gru2,gru,pooling") predictor: tf.app.flags.DEFINE_string("model_dpcnn", "dp_cnn", "name of model:han,c_gru,c_gru2,gru,text_cnn") tf.app.flags.DEFINE_string("ckpt_dir_dpcnn", "predictor/checkpoint_dpcnn_big32/", "checkpoint location for the model")

tf.app.flags.DEFINE_string("model", "text_cnn", "name of model:han,c_gru,c_gru2,gru,text_cnn") tf.app.flags.DEFINE_string("ckpt_dir", "predictor/checkpoint/", "checkpoint location for the model")

当训练模型的时候是用text_cnn, 不理解在预测的时候为什么是用的text_cnn和dpcnn. 难道是在训练模型的时候,需要再训练dpcnn吗?谢谢您的帮助。

brightmart commented 6 years ago

there are several models available for you. if you train use text_cnn, during predict/test you also need to use text_cnn.

just by add parameter --model=text_cnn during predict/test


发件人: tangdouer notifications@github.com 发送时间: 2018年6月27日 11:02 收件人: brightmart/ai_law 抄送: Subscribed 主题: [brightmart/ai_law] train and predictor (#4)

train: tf.app.flags.DEFINE_string("ckpt_dir","./predictor/checkpoint/","checkpoint location for the model") tf.app.flags.DEFINE_string("model","text_cnn","name of model:han,text_cnn,dp_cnn,c_gru,c_gru2,gru,pooling") predictor: tf.app.flags.DEFINE_string("model_dpcnn", "dp_cnn", "name of model:han,c_gru,c_gru2,gru,text_cnn") tf.app.flags.DEFINE_string("ckpt_dir_dpcnn", "predictor/checkpoint_dpcnn_big32/", "checkpoint location for the model")

tf.app.flags.DEFINE_string("model", "text_cnn", "name of model:han,c_gru,c_gru2,gru,text_cnn") tf.app.flags.DEFINE_string("ckpt_dir", "predictor/checkpoint/", "checkpoint location for the model")

当训练模型的时候是用text_cnn, 不理解在预测的时候为什么是用的text_cnn和dpcnn. 难道是在训练模型的时候,需要再训练dpcnn吗?谢谢您的帮助。

― You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fbrightmart%2Fai_law%2Fissues%2F4&data=02%7C01%7C%7C41209f48991b48325e8d08d5dbda727d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636656653625175443&sdata=S%2BiJgyT1sjc40uW%2FWsObPy45kpUa%2B%2F5p2A6NV5gp6ms%3D&reserved=0, or mute the threadhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FASuYMBZ9NedV-LKrukmiMeQ-_GiULhUpks5uAvXQgaJpZM4U4-66&data=02%7C01%7C%7C41209f48991b48325e8d08d5dbda727d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636656653625175443&sdata=%2FjgEneGOkWhNSweGF87NmKNE%2F2%2F8HDHY7AWDaLmiyb0%3D&reserved=0.

tangdouer commented 6 years ago

我使用命令 python main.py --model=text_cnn 还是会出现下面的错,请问应该怎么解决呀 Traceback (most recent call last): File "/home/qiu/PycharmProjects/ai_law-master (2)/main.py", line 8, in predict=Predictor() File "/home/qiu/PycharmProjects/ai_law-master (2)/predictor/predictor.py", line 84, in init saver_big.restore(sess_big, tf.train.latest_checkpoint(FLAGS.ckpt_dir_dpcnn)) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1796, in restore raise ValueError("Can't load save_path when it is None.") ValueError: Can't load save_path when it is None.

tangdouer commented 6 years ago

Thank you very much. This problem was solved.