pointer-generator
pointer-generator copied to clipboard
How to use the pretrain model?
if i want to use the model pretrained,which parameter shold i set and how?
- Download the CNN data
- Download the pointer-generator-master
- Download the pretrained model and put into same directory as pointer-generator-master
- Run the line below (chunked data is from CNN, vocab is also from CNN directory, log_root is any directory you make to save logs, experiment name is "myexperiment"
python run_summarization.py --mode=train --data_path=/path/to/chunked/train_* --vocab_path=/path/to/vocab --log_root=/path/to/a/log/directory --exp_name=myexperiment
@mohman22 don't you just need to run the decoder portion (--mode=decode
) of the code if you are using only the pre-trained model?
download the pretrained zip file extract it and open the readme file you will find this command at the end of the readme file
If you'd like to see randomly-generated examples from the validation set print to screen, run:
python run_summarization.py --mode=decode --data_path=/path/to/data/val_* --vocab_path=/path/to/data/vocab --log_root=/path/to/directory/containing/pretrained_model --exp_name=pretrained_model --max_enc_steps=400 --max_dec_steps=120 --coverage=1
after extracting the zip file ...there will be folder with the same name as the zip file..rename it to "pretrained_model" and in the command replace the log_root path with the path of the pretrained_model folder, for exmple if the path of the renamed pretrained_model folder was ---> "/ss/dd/pretrained_model" ...... the command would be --log_root="/ss/dd". The point is that code append the exp_name to the log_root and make it the path to look for a folder named train and looks for checkpoint inside the train folder.
I have followed the steps mentioned here to run the pretrained model but i am getting this error "TypeError: unsupported operand type(s) for *: 'int' and 'Flag'" What should I do?
Which tensor fow version are you using?
I checked the version it was 1.7.0 . I have installed 1.2.1 and now i am getting this error AssertionError: Error: Empty filelist at ../finished_files/val_*
I have checked this file but it has content in it
Have you prepared the dataset the way written in readme file of the repo?
On Tue, Apr 10, 2018, 6:53 AM Ann1583 [email protected] wrote:
I checked the version it was 1.7.0 . I have installed 1.2.1 and now i am getting this error AssertionError: Error: Empty filelist at ../finished_files/val_*
I have checked this file but it has content in it
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/abisee/pointer-generator/issues/77#issuecomment-379973345, or mute the thread https://github.com/notifications/unsubscribe-auth/ARqRdiZ2mVgTbpTJtSg08uZmrMaUPgHkks5tnDrEgaJpZM4R4H0T .
Refer your file "run_summarization.py" and this: https://stackoverflow.com/questions/49206318/typeerror-unsupported-operand-types-for-int-and-flag/49734816#49734816 Works fine with newer tf versions.
@yomnaa I actually downloaded the processed data files provided by JafferWilson https://github.com/JafferWilson/Process-Data-of-CNN-DailyMail
Should I process the files myself? I was having trouble with Stanford CoreNLP, that's why I switched to these processed files.
I have followed the steps mentioned here to run the pretrained model but i am getting this error "TypeError: unsupported operand type(s) for *: 'int' and 'Flag'" What should I do?
@Ann1583 If you still haven't solved this : Just replace https://github.com/abisee/pointer-generator/blob/879cdb3e0dd1d17210d0e24f545c843c33a39cef/run_summarization.py#L299 with hps_dict[key] = val.value # add it to the dict. This works because val is a flag object, and val.value gives you the value of the flag. Hope this helps!
In the command what does the following parameter refer to? --data_path=/path/to/data/val_* Please can anyone explain. Thanks in Advance
@yasersakkaf path to validation data?
I have followed the steps mentioned here to run the pretrained model but i am getting this error "TypeError: unsupported operand type(s) for *: 'int' and 'Flag'" What should I do?
use .value to your batch.py file on the line it is giving error
or you can use my updated repo to tensorflow 1.12, that oughta take care of it all, here
@yasersakkaf I guess it refers to the validation dataset i.e the val.bin file in the finished files if you're using the given dataset
I have followed the steps mentioned here to run the pretrained model but i am getting this error "TypeError: unsupported operand type(s) for *: 'int' and 'Flag'" What should I do?
.vlaue 能够将flag转换为int