class_docstr: Joint denoising training task for speech and text.
class_docstr_tok: ["Joint","denoising","training","task","for","speech","and","text","."]
code: def get_batch_iterator(
      self,
      dataset,
      max_tokens=None,
      max_sentences=None,
      max_positions=None,
      ignore_invalid_inputs=False,
      required_batch_size_multiple=1,
      seed=1,
      num_shards=1,
      shard_id=0,
      num_workers=0,
      epoch=0,
      data_buffer_size=0,
      disable_iterator_cache=False,
      skip_remainder_batch=False,
      grouped_shuffling=False,
      update_epoch_batch_itr=False,
  ):
      assert isinstance(dataset, MultiModalityDataset)
      if len(dataset.id_to_mode) == 1:
          max_positions = dataset.max_positions[0]
          max_tokens = dataset.max_tokens[0]
          max_sentences = dataset.max_sentences[0]
          return super().get_batch_iterator(
              dataset,
              max_tokens,
              max_sentences,
              max_positions,
              ignore_invalid_inputs,
              required_batch_size_multiple,
              seed,
              num_shards,
              shard_id,
              num_workers,
              epoch,
              data_buffer_size,
              disable_iterator_cache,
              skip_remainder_batch=skip_remainder_batch,
          )
  
      mult_ratio = []
      (
          text_ratio,
          bitext_ratio,
          sup_ratio,
          sup_s2s_ratio,
          unsup_ratio,
      ) = self.get_sample_ratio(epoch)
      for mode in dataset.id_to_mode:
          if mode in ("sup_speech_ctc", "sup_speech_ali"):
              mult_ratio.append(sup_ratio)
          elif mode == "sup_speech_s2s":
              mult_ratio.append(sup_s2s_ratio)
          elif mode == "text":
              mult_ratio.append(text_ratio)
          elif mode == "bitext":
              mult_ratio.append(bitext_ratio)
          elif mode == "unsup_speech":
              mult_ratio.append(unsup_ratio)
  
      # initialize the dataset with the correct starting epoch
      dataset.set_epoch(epoch)
  
      batch_samplers = dataset.get_batch_samplers(
          mult_ratio, required_batch_size_multiple, seed
      )
  
      # return a reusable, sharded iterator
      epoch_iter = GroupedEpochBatchIterator(
          dataset=dataset,
          collate_fn=dataset.collater,
          batch_samplers=batch_samplers,
          seed=seed,
          num_shards=num_shards,
          shard_id=shard_id,
          num_workers=num_workers,
          epoch=epoch,
          mult_rate=max(self.args.update_freq)
          if self.args.same_data_update
          else 1,
          buffer_size=data_buffer_size,
          skip_remainder_batch=skip_remainder_batch,
      )
      self.dataset_to_epoch_iter[dataset] = {}  # refresh it every epoch
      return epoch_iter
  
imports: import logging
  import os
  import re
  from argparse import Namespace
  from pathlib import Path
  from fairseq.data import ConcatDataset, Dictionary, encoders
  from fairseq.data.audio.multi_modality_dataset import FileAudioDatasetWrapper, ModalityDatasetItem, MultiModalityDataset
  from fairseq.data.audio.speech_to_text_joint_dataset import S2TJointDataConfig, SpeechToTextJointDatasetCreator
  from fairseq.data.iterators import GroupedEpochBatchIterator
  from fairseq.tasks import register_task
  from .pair_denoising import PairedDenoisingTask
label_desc: Use image node_id 11 for calling the SpeechTextJointDenoisingPreTask obj's underlying member method code with example usage: obj.get_batch_iterator(dataset, max_tokens, max_sentences, max_positions, ignore_invalid_inputs, required_batch_size_multiple, seed, num_shards, shard_id, num_workers, epoch, data_buffer_size, disable_iterator_cache, skip_remainder_batch, grouped_shuffling, update_epoch_batch_itr) and returns: epoch_iter, super