'TranslationFromPretrainedBARTTask' object has no attribute 'args'
See original GitHub issue🐛 Bug
Traceback (most recent call last): File “/home/gpu24/work/fairseq/.venv/bin/fairseq-interactive”, line 33, in <module> 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
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:11 (2 by maintainers)
Top GitHub Comments
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.same issue here, reverting to a previous commit solves the issue temporarily