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_dataset_for_inference(
      self, src_tokens, src_lengths, constraints=None
  ):
      src_lang_id = self.source_dictionary.index(
          "[{}]".format(self.args.source_lang)
      )
      source_tokens = []
      for s_t in src_tokens:
          s_t = torch.cat([s_t, s_t.new(1).fill_(src_lang_id)])
          source_tokens.append(s_t)
      dataset = LanguagePairDataset(
          source_tokens,
          src_lengths,
          self.source_dictionary,
          tgt_dict=self.target_dictionary,
          constraints=constraints,
      )
      return dataset
  
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 5 for calling the TranslationFromPretrainedBARTTask obj's underlying member method code with example usage: obj.build_dataset_for_inference(src_tokens, src_lengths, constraints) and returns: dataset