fairseq icon indicating copy to clipboard operation
fairseq copied to clipboard

'TranslationFromPretrainedBARTTask' object has no attribute 'args'

Open jtorrev opened this issue 5 years ago • 11 comments

🐛 Bug

Traceback (most recent call last): File "/home/gpu24/work/fairseq/.venv/bin/fairseq-interactive", line 33, in sys.exit(load_entry_point('fairseq', 'console_scripts', 'fairseq-interactive')()) File "/home/gpu24/work/fairseq2/fairseq/fairseq_cli/interactive.py", line 318, in cli_main distributed_utils.call_main(convert_namespace_to_omegaconf(args), main) File "/home/gpu24/work/fairseq2/fairseq/fairseq/distributed_utils.py", line 337, in call_main main(cfg, **kwargs) File "/home/gpu24/work/fairseq2/fairseq/fairseq_cli/interactive.py", line 176, in main generator = task.build_generator(models, cfg.generation) File "/home/gpu24/work/fairseq2/fairseq/fairseq/tasks/translation_from_pretrained_bart.py", line 117, in build_generator eos=self.tgt_dict.index("[{}]".format(self.args.target_lang)), #args. AttributeError: 'TranslationFromPretrainedBARTTask' object has no attribute 'args'

To Reproduce

langs=ar_AR,cs_CZ,de_DE,en_XX,es_XX,et_EE,fi_FI,fr_XX,gu_IN,hi_IN,it_IT,ja_XX,kk_KZ,ko_KR,lt_LT,lv_LV,my_MM,ne_NP,nl_XX,ro_RO,ru_RU,si_LK,tr_TR,vi_VN,zh_CN fairseq-interactive data-bin/en-es --path models/enes/checkpoint_best.pt --task translation_from_pretrained_bart -t es_XX -s en_XX --langs $langs --remove-bpe 'sentencepiece' --beam 5 --cpu

Code sample

Expected behavior

Environment

  • fairseq Version (e.g., 1.0 or master): 1.0.0
  • PyTorch Version (e.g., 1.0) 1.7.1
  • OS (e.g., Linux):Ubuntu 18.04
  • How you installed fairseq (pip, source): source
  • Build command you used (if compiling from source):
  • Python version: 3.7
  • CUDA/cuDNN version: 10.1
  • GPU models and configuration: Nvidia 3090
  • Any other relevant information:

Additional context

jtorrev avatar Jan 27 '21 01:01 jtorrev

same issue here

hyeonseokk avatar Jan 27 '21 03:01 hyeonseokk

same issue here

zwhe99 avatar Jan 27 '21 16:01 zwhe99

CC @myleott @ngoyal2707 did this file not get updated in the hydra integration? Looks like we should be using self.cfg instead of self.args

lematt1991 avatar Jan 28 '21 20:01 lematt1991

i am also having the same issue. my training code that worked 3 weeks ago does not work anymore

demegire avatar Feb 07 '21 19:02 demegire

same issue here, reverting to a previous commit solves the issue temporarily

trina731 avatar Feb 10 '21 18:02 trina731

same issue here, reverting to a previous commit solves the issue temporarily

Which previous commit?

tangxiangru avatar Feb 20 '21 10:02 tangxiangru

Same issue here

oaarnikoivu avatar Jun 15 '21 16:06 oaarnikoivu

Same issue here

louismartin avatar Jun 16 '21 11:06 louismartin

pip install fairseq==0.10.2
It works for me.

longxudou avatar Aug 16 '21 13:08 longxudou

try to add self.args = args in the def init(self, args, src_dict, tgt_dict): of translation_from_pretrained_bart.py It works for me.

sunht18 avatar Nov 18 '21 08:11 sunht18

try to add self.args = args in the def init(self, args, src_dict, tgt_dict): of translation_from_pretrained_bart.py It works for me.

thank you , it also works for me.

jiaohuix avatar Jul 16 '22 09:07 jiaohuix