Text-Generate-RNN icon indicating copy to clipboard operation
Text-Generate-RNN copied to clipboard

concern on sentence

Open niranjan8129 opened this issue 5 years ago • 9 comments

I liked your model . i have concern .does it generate sentence ?

eg input : fever output : i am having fever since last night

niranjan8129 avatar Dec 12 '18 07:12 niranjan8129

This model forms a sentence by predicting the next word in the previous article. In other words, the input word will be the first word of the sentence, not in the sentence.

I think this sence is match your concern:

input: fever output: fever i am having fever since last night.

the input word is the fisrt word in the generate sentence and the model is work.

stardut avatar Dec 12 '18 08:12 stardut

Thanks for your quick response . I will try now . one more help .. how to create vocab.pkl file ? could you please upload vocab.pkl model/source code if you have ?

niranjan8129 avatar Dec 12 '18 17:12 niranjan8129

The vocab.pkl was created by the training data file tang in /data/tang while running train.py. You need to modify the training data file to your train data in train.py and sample.py :

data_dir = 'data/'
input_file = 'tang' #change to your train data file path. Each row represents a training data in the training file.
vocab_file = 'vocab.pkl'  # create when run train.py
tensor_file = 'tensor.npy' # create when run train.py

stardut avatar Dec 14 '18 06:12 stardut

Thank you friend from bottom of my heart.. i am extremely delighted for your prompt response . Please clear me If i am not wrong. both tang and poetry data sets are different .. right?

Also, below text variables are input text.
text1 = '两个黄鹂鸣翠柳,' text2 = '<《春》 ' text3 = '<'

pleases drop a text to [email protected] if you dont feel bad.

Thanks Niranjan

niranjan8129 avatar Dec 15 '18 04:12 niranjan8129

Yes, you are right.

stardut avatar Dec 17 '18 06:12 stardut

Hi friend , wish you a happy new year to you and your family . I was trying to train the model but it did not complete after running 26 hours with high end machine . Could you please help me the issue ?

niranjan8129 avatar Jan 01 '19 04:01 niranjan8129

Happy new year. The model net will be run forever and the model will be saved every 1000 step. So you can use it do something you want.

stardut avatar Jan 02 '19 01:01 stardut

Hi friend , I tried but could not figure out how to stop/completed after some batchsize/epoch . Could you please help me where I need to change the code if you dont mind

niranjan8129 avatar Jan 04 '19 04:01 niranjan8129

Hi friend , I tried but could not figure out how to stop/completed after some batchsize/epoch . Could you please help me where I need to change the code if you dont mind

Hi friend , I tried but could not figure out how to stop/completed after some batchsize/epoch . Could you please help me where I need to change the code if you dont mind

你不需要把整个epoch跑完,只要有模型保存就可以使用了,但是如果没有训练完的话跑出来的效果预计不好。具体操作就是:运行train.py以后会生成一个model文件夹里面就保存了训练出来的模型,名字大致长这个样子model_loss_2.0342.ckpt-587000加上后缀名,之后就在sample.py文件大概33行指定模型,具体代码就是 #saver.restore(self.sess, 'model/model') #saver.restore(self.sess, tf.train.latest_checkpoint("model/")) saver.restore(self.sess, "model/model_loss_2.0342.ckpt-587000") 其中model_loss_2.0342.ckpt-587000是我跑出来的已经保存在model文件夹的模型 正如原作者所说,不需要跑完所有的epoch,只要有模型保存,就可以拿来使用了!

frostbite-zhs avatar Sep 10 '19 08:09 frostbite-zhs