fairseq
fairseq copied to clipboard
mBART model code for translation encounters errors.
🐛 Bug
The code for the mBART50 model seems to contain some bugs.
The file 'hub_utils.py' contains a 'translate' function. It encounters an error: TypeError: TranslationMultiSimpleEpochTask.build_generator() got an unexpected keyword argument 'prefix_allowed_tokens_fn' on line 192 in the file 'fairseq/hub_utils.py.
After commenting this line, the next error is: KeyError: None on line 460 in the file 'fairseq/data/multilingual/multilingual_data_manager.py'.
Then I tried setting the target_lang by executing the command 'bart.task.args.target_lang = "fr_XX"' before calling the translate function. This leads to a translation but then the translate function exhibits weird behaviour and the target language cannot be changed again.
hi @HenningBuhl did you find solution to this?