question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'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:open
  • Created 3 years ago
  • Reactions:5
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
sunht18commented, Nov 18, 2021

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.

6reactions
trina731commented, Feb 10, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

'TranslationFromPretrainedBARTTask' object has no attribute ...
'TranslationFromPretrainedBARTTask' object has no attribute ... distributed_utils.call_main(convert_namespace_to_omegaconf(args), main)
Read more >
'TranslationFromPretrainedBARTTask' object ... - Python 博客
Yes, TranslationTask uses self.cfg instead of self.args now. And the quicker fix is to do it yourself and upload it, so enjoy it....
Read more >
Help Contribute to pytorch/fairseq - Python - CodeTriage
... 'TranslationFromPretrainedBARTTask' object has no attribute 'args' · sys.exit in fairseq-hydra-train hides torch.utils.bottleneck · Adapting Wav2Vec for ...
Read more >
AttributeError: type object has no attribute (problem with *args?)
You have to assign place() to a variable (making it an instance), before using that variable (as an instance). That's why all of...
Read more >
'dict' object has no attribute 'task' while decoding the language ...
... in __init__ with open_dict(lm_args.task): AttributeError: 'dict' object has no attribute 'task'. The command I am using is a folows:-.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found