docstr: Setup the task.
docstr_tok: ["Setup","the","task","."]
code: def setup_task(cls, args, **kwargs):
      """Setup the task."""
      paths = args.data.split(":")
      assert len(paths) > 0
      src_dict = Dictionary.load(
          os.path.join(paths[0], "src_dict.txt")
      )  # assume all languages share a source dictionary
      tgt_dict = Dictionary.load(
          os.path.join(paths[0], "tgt_dict.txt")
      )  # assume all languages share a target dictionary
  
      lang_pairs = args.lang_pairs + "," + args.lang_pairs_bitext
      lang_pairs = re.sub(",$", "", re.sub("^,", "", lang_pairs))
      src_langs = [lp.split("-")[0] for lp in lang_pairs.split(",")]
      tgt_langs = [lp.split("-")[1] for lp in lang_pairs.split(",")]
  
      if args.add_src_lang_token:
          for lang in src_langs:
              assert (
                  src_dict.index(
                      PairedDenoisingTask.LANG_TAG_TEMPLATE.format(lang)
                  )
                  != src_dict.unk()
              )
      if args.add_tgt_lang_token:
          for lang in tgt_langs:
              assert (
                  tgt_dict.index(
                      PairedDenoisingTask.LANG_TAG_TEMPLATE.format(lang)
                  )
                  != tgt_dict.unk()
              )
  
      logger.info("source dictionary: {} types".format(len(src_dict)))
      logger.info("target dictionary: {} types".format(len(tgt_dict)))
      if not hasattr(args, "shuffle_instance"):
          args.shuffle_instance = False
      return cls(args, src_dict, tgt_dict)
  
imports: import itertools
  import logging
  import os
  import re
  import numpy
  import torch
  from examples.speech_text_joint_to_text.data.pair_denoising_dataset import LanguagePairDenoisingDataset
  from fairseq import utils
  from fairseq.data import ConcatDataset, Dictionary, LanguagePairDataset, ResamplingDataset, TransformEosConcatLangPairDataset, TransformEosLangPairDataset, data_utils, indexed_dataset
  from fairseq.data.encoders.utils import get_whole_word_mask
  from fairseq.tasks import register_task
  from fairseq.tasks.translation import TranslationTask
label_desc: Use image node_id 2 for calling the PairedDenoisingTask obj's underlying member method code with example usage: obj.setup_task(cls, args) and returns: cls