class_docstr: Task for joint training speech and text to text.
class_docstr_tok: ["Task","for","joint","training","speech","and","text","to","text","."]
code: def load_langpair_dataset(
      self, prepend_tgt_lang_tag=False, sampling_alpha=1.0, epoch=0
  ):
      lang_pairs = []
      text_dataset = None
      split = "train"
      for lp in self.args.langpairs.split(","):
          src, tgt = lp.split("-")
          text_dataset = load_langpair_dataset(
              self.args.parallel_text_data,
              split,
              src,
              self.src_dict,
              tgt,
              self.tgt_dict,
              combine=True,
              dataset_impl=None,
              upsample_primary=1,
              left_pad_source=False,
              left_pad_target=False,
              max_source_positions=self.args.max_positions_text,
              max_target_positions=self.args.max_target_positions,
              load_alignments=False,
              truncate_source=False,
          )
          if prepend_tgt_lang_tag:
              # TODO
              text_dataset = TransformEosLangPairDataset(
                  text_dataset,
                  src_eos=self.src_dict.eos(),
                  tgt_bos=self.tgt_dict.eos(),  # 'prev_output_tokens' starts with eos
                  new_tgt_bos=self.tgt_dict.index(
                      LANG_TAG_TEMPLATE.format(tgt)
                  ),
              )
          lang_pairs.append(text_dataset)
      if len(lang_pairs) > 1:
          if sampling_alpha != 1.0:
              size_ratios = SpeechToTextDatasetCreator.get_size_ratios(
                  self.args.langpairs.split(","),
                  [len(s) for s in lang_pairs],
                  alpha=sampling_alpha,
              )
              lang_pairs = [
                  ResamplingDataset(
                      d, size_ratio=r, epoch=epoch, replace=(r >= 1.0)
                  )
                  for d, r in zip(lang_pairs, size_ratios)
              ]
          return ConcatDataset(lang_pairs)
      return text_dataset
  
imports: import logging
  import os
  from argparse import Namespace
  from pathlib import Path
  import torch
  from fairseq.data import encoders, Dictionary, ResamplingDataset, TransformEosLangPairDataset, ConcatDataset
  from fairseq.data.iterators import GroupedEpochBatchIterator
  from fairseq.data.audio.multi_modality_dataset import MultiModalityDataset, LangPairMaskDataset, ModalityDatasetItem
  from fairseq.data.audio.speech_to_text_dataset import SpeechToTextDataset, SpeechToTextDatasetCreator
  from fairseq.data.audio.speech_to_text_joint_dataset import S2TJointDataConfig, SpeechToTextJointDatasetCreator
  from fairseq.tasks import register_task
  from fairseq.tasks.speech_to_text import SpeechToTextTask
  from fairseq.tasks.translation import load_langpair_dataset
label_desc: Use image node_id 4 for calling the SpeechTextJointToTextTask obj's underlying member method code with example usage: obj.load_langpair_dataset(prepend_tgt_lang_tag, sampling_alpha, epoch) and returns: text_dataset, ConcatDataset