pointer-generator icon indicating copy to clipboard operation
pointer-generator copied to clipboard

How to use the pretrain model?

Open zhhengcs opened this issue 7 years ago • 16 comments

if i want to use the model pretrained,which parameter shold i set and how?

zhhengcs avatar Feb 03 '18 10:02 zhhengcs

  1. Download the CNN data
  2. Download the pointer-generator-master
  3. Download the pretrained model and put into same directory as pointer-generator-master
  4. 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 avatar Feb 09 '18 12:02 mohman22

@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?

scigeek72 avatar Feb 12 '18 22:02 scigeek72

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.

yomnaa avatar Feb 22 '18 15:02 yomnaa

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 avatar Apr 09 '18 17:04 Ann1583

Which tensor fow version are you using?

yomnaa avatar Apr 09 '18 19:04 yomnaa

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

Ann1583 avatar Apr 10 '18 04:04 Ann1583

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 .

yomnaa avatar Apr 10 '18 09:04 yomnaa

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.

RaiAbhishek avatar Apr 10 '18 12:04 RaiAbhishek

@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.

Ann1583 avatar Apr 10 '18 16:04 Ann1583

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!

Namrata96 avatar Apr 25 '18 17:04 Namrata96

In the command what does the following parameter refer to? --data_path=/path/to/data/val_* Please can anyone explain. Thanks in Advance

yasersakkaf avatar May 08 '18 13:05 yasersakkaf

@yasersakkaf path to validation data?

shivam13juna avatar Jan 02 '19 09:01 shivam13juna

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

jawalemohit avatar Feb 17 '19 07:02 jawalemohit

or you can use my updated repo to tensorflow 1.12, that oughta take care of it all, here

shivam13juna avatar Feb 17 '19 07:02 shivam13juna

@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

ojassm avatar Jun 30 '19 17:06 ojassm

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

husongjiang avatar Aug 14 '19 02:08 husongjiang