class_docstr: Encoder decoder class for speaker label models.
  Model class creates training, validation methods for setting up data
  performing model forward pass.
  Expects config dict for
      * preprocessor
      * Jasper/Quartznet Encoder
      * Speaker Decoder
class_docstr_tok: ["Encoder","decoder","class","for","speaker","label","models",".","Model","class","creates","training",",","validation","methods","for","setting","up","data","performing","model","forward","pass",".","Expects","config","dict","for","*","preprocessor","*","Jasper\/Quartznet","Encoder","*","Speaker","Decoder"]
code: def setup_training_data(
      self, train_data_layer_config: Optional[Union[DictConfig, Dict]]
  ):
      if self.cal_labels_occurrence_train:
          # Calculate labels occurence for weighed CE loss for train set if weight equals 'auto'
          # Note in this case, the cal_labels_occurrence in val_data_layer_config and test_data_layer_params need to be stay as False
          OmegaConf.set_struct(train_data_layer_config, True)
          with open_dict(train_data_layer_config):
              train_data_layer_config["cal_labels_occurrence"] = True
  
      self.labels = self.extract_labels(train_data_layer_config)
      train_data_layer_config["labels"] = self.labels
      if "shuffle" not in train_data_layer_config:
          train_data_layer_config["shuffle"] = True
      self._train_dl = self.__setup_dataloader_from_config(
          config=train_data_layer_config
      )
      # Need to set this because if using an IterableDataset, the length of the dataloader is the total number
      # of samples rather than the number of batches, and this messes up the tqdm progress bar.
      # So we set the number of steps manually (to the correct number) to fix this.
      if (
          self._train_dl is not None
          and hasattr(self._train_dl, "dataset")
          and isinstance(
              self._train_dl.dataset, torch.utils.data.IterableDataset
          )
      ):
          # We also need to check if limit_train_batches is already set.
          # If it's an int, we assume that the user has set it to something sane, i.e. <= # training batches,
          # and don't change it. Otherwise, adjust batches accordingly if it's a float (including 1.0).
          if self._trainer is not None and isinstance(
              self._trainer.limit_train_batches, float
          ):
              self._trainer.limit_train_batches = int(
                  self._trainer.limit_train_batches
                  * ceil(
                      (len(self._train_dl.dataset) / self.world_size)
                      / train_data_layer_config["batch_size"]
                  )
              )
          elif self._trainer is None:
              logging.warning(
                  "Model Trainer was not set before constructing the dataset, incorrect number of "
                  "training batches will be used. Please set the trainer and rebuild the dataset."
              )
  
imports: import copy
  import itertools
  from collections import Counter
  from math import ceil
  from typing import Dict, List, Optional, Union
  import librosa
  import numpy
  import soundfile
  import torch
  from hydra.utils import instantiate
  from omegaconf import DictConfig, OmegaConf, open_dict
  from pytorch_lightning import Trainer
  from torchmetrics import Accuracy
  from tqdm import tqdm
  from nemo.collections.asr.data.audio_to_label import AudioToSpeechLabelDataset, cache_datastore_manifests
  from nemo.collections.asr.data.audio_to_label_dataset import get_concat_tarred_speech_label_dataset, get_tarred_speech_label_dataset
  from nemo.collections.asr.data.audio_to_text_dataset import convert_to_config_list
  from nemo.collections.asr.models.asr_model import ExportableEncDecModel
  from nemo.collections.asr.parts.preprocessing.features import WaveformFeaturizer
  from nemo.collections.asr.parts.preprocessing.perturb import process_augmentations
  from nemo.collections.common.metrics import TopKClassificationAccuracy
  from nemo.collections.common.parts.preprocessing.collections import ASRSpeechLabel
  from nemo.core.classes import ModelPT
  from nemo.core.classes.common import PretrainedModelInfo, typecheck
  from nemo.core.neural_types import *
  from nemo.utils import logging
label_desc: Use image node_id 5 for calling the EncDecSpeakerLabelModel obj's underlying member method code with example usage: obj.setup_training_data(train_data_layer_config) without return types