class_docstr: Translate from source language to target language with a model initialized with a multilingual pretrain.
  
  Args:
      src_dict (~fairseq.data.Dictionary): dictionary for the source language
      tgt_dict (~fairseq.data.Dictionary): dictionary for the target language
  
  .. note::
  
      The translation task is compatible with :mod:`fairseq-train`,
      :mod:`fairseq-generate` and :mod:`fairseq-interactive`.
  
  The translation task provides the following additional command-line
  arguments:
  
  .. argparse::
      :ref: fairseq.tasks.translation_parser
      :prog:
code: def build_generator(self, models, args, **unused):
      if getattr(args, "score_reference", False):
          from fairseq.sequence_scorer import SequenceScorer
  
          return SequenceScorer(
              self.target_dictionary,
              eos=self.tgt_dict.index(
                  "[{}]".format(self.args.target_lang)
              ),
          )
      else:
          from fairseq.sequence_generator import SequenceGenerator
  
          return SequenceGenerator(
              models,
              self.target_dictionary,
              beam_size=getattr(args, "beam", 5),
              max_len_a=getattr(args, "max_len_a", 0),
              max_len_b=getattr(args, "max_len_b", 200),
              min_len=getattr(args, "min_len", 1),
              normalize_scores=(
                  not getattr(args, "unnormalized", False)
              ),
              len_penalty=getattr(args, "lenpen", 1),
              unk_penalty=getattr(args, "unkpen", 0),
              temperature=getattr(args, "temperature", 1.0),
              match_source_len=getattr(args, "match_source_len", False),
              no_repeat_ngram_size=getattr(
                  args, "no_repeat_ngram_size", 0
              ),
              eos=self.tgt_dict.index(
                  "[{}]".format(self.args.target_lang)
              ),
          )
  
file_path: fairseq/fairseq/tasks/translation_from_pretrained_bart.py
imports: import torch
  from fairseq import utils
  from fairseq.data import LanguagePairDataset
  from .None import register_task
  from .translation import TranslationTask, load_langpair_dataset
label_desc: Use image node_id 4 for calling the TranslationFromPretrainedBARTTask obj's underlying member method code with example usage: obj.build_generator(models, args) and returns: SequenceScorer, SequenceGenerator