Open Remorax opened 3 years ago
@Remorax do you have solved this problem ?
I solved this by adding
--eval-bleu --eval-bleu-args --eval-bleu-detok --eval-bleu-remove-bpe
flag(for detail args, recommend to see fairseq/examples/translation). I think only '--best-checkpoint-metric' bleu flag doesn't work alone.
@Remorax have you solved this problem ?
you can try this
--eval-bleu --eval-bleu-args --eval-bleu-detok --eval-bleu-remove-bpe
I am getting fairseq-train: error: unrecognized arguments: --eval-bleu --eval-bleu-args --eval-bleu-detok --eval-bleu-remove-bpe
Anyone can suggest how to solve this?
@XiaoqingNLP @Remorax @zhongmz @kimziwoo can you please help me in resolving my error. The details are mentioned above - https://github.com/facebookresearch/fairseq/issues/3881#issuecomment-1363920662
@nikhiljaiswal Have u solve this issue yet? As I am also facing this issue
@yugaljain1999 这个我捣鼓了几天,fairseq_的train.py有一个validate的函数trainer.validate(),每次处理一个batch的数据,所以我计算的是一个batch的f1-score,然后使用meter.log 录入到树里,meter.get_smooth_value,会将录入的求平均。 所以你需要改的是在你的task重写一个函数,task继承的fairseq_task,在fairseq里面有那个函数。首先在task里继承fairseq_task的valid_step()函数,每次batch会调用它一次,在里面计算你的指标,然后录入到树里:在task里重写一下这个函数 def reduce_metrics(self, logging_outputs, criterion): super().reduce_metrics(logging_outputs, criterion) ······· metrics.log_scalar('F1-score',f1_scores) 就可以了。如果要计算整个valid的指标,就需要在train.py哪里修改计算了
@yugaljain1999 这个我捣鼓了几天,fairseq_的train.py有一个validate的函数trainer.validate(),每次处理一个batch的数据,所以我计算的是一个batch的f1-score,然后使用meter.log 录入到树里,meter.get_smooth_value,会将录入的求平均。 所以你需要改的是在你的task重写一个函数,task继承的fairseq_task,在fairseq里面有那个函数。首先在task里继承fairseq_task的valid_step()函数,每次batch会调用它一次,在里面计算你的指标,然后录入到树里:在task里重写一下这个函数 def reduce_metrics(self, logging_outputs, criterion): super().reduce_metrics(logging_outputs, criterion) ······· metrics.log_scalar('F1-score',f1_scores) 就可以了。如果要计算整个valid的指标,就需要在train.py哪里修改计算了
I'm facing the same issue.
@nikhiljaiswal in your case maybe the issue can be resolved by setting the task to be translation (--task translation
) and maybe it could work. In my case I cannot do this as my task has to be --task translation_multi_simple_epoch
(https://github.com/facebookresearch/fairseq/blob/main/examples/multilingual/README.md)
🐛 Bug
Unable to use BLEU as a metric for saving best checkpoint, despite example translation scripts showing it can be used as one. A
KeyError
is obtained in my case.There is also no documentation available on what are the valid values that can be used as
--best-checkpoint-metric
.To Reproduce
Steps to reproduce the behavior:
fairseq-train
withbest_checkpoint_metric
Code sample
This is the command I ran:
Expected behavior
Environment
pip
, source): sourcepip3 install --editable .