microsoft / ProphetNet

A research project for natural language generation, containing the official implementations by MSRA NLC team.
MIT License
686 stars 109 forks source link

KeyError during inference with dialog-en model #49

Open raviteja5 opened 2 years ago

raviteja5 commented 2 years ago

Hi,

Using fairseq cli, I ran the preprocessing for test files only to generate binaries, and then tried running the inference with prophetnet-dialog-en model.

Here is my code: ` fairseq-preprocess \ --user-dir prophetnet \ --task translation_prophetnet \ --source-lang src --target-lang tgt \ --testpref tokenized_test \ --destdir processed --srcdict vocab.txt --tgtdict vocab.txt \ --workers 20

BEAM=5 LENPEN=1.5 CHECK_POINT=prophetnet-dialog-en.pt TEMP_FILE=fairseq_outputs.txt OUTPUT_FILE=sorted_outputs.txt

fairseq-generate processed --path $CHECK_POINT --user-dir prophetnet --task translation_prophetnet --batch-size 80 --gen-subset test --beam $BEAM --num-workers 4 --no-repeat-ngram-size 3 --lenpen $LENPEN 2>&1 > $TEMP_FILE grep ^H $TEMP_FILE | cut -c 3- | sort -n | cut -f3- | sed "s/ ##//g" > $OUTPUT_FILE`

I got the following error. Would appreciate any advice on this. Thank you!

/usr/local/lib/python3.6/dist-packages/fairseq/checkpoint_utils.py in _upgrade_state_dict(state) --> 300 {"criterion_name": "CrossEntropyCriterion", "best_loss": state["best_loss"]} KeyError: 'best_loss'

gaokaizhi commented 1 year ago

I meet the same question, Have you solved this?