class_docstr: The collate class for LibriSpeech or LibriLightLimited dataset.
class_docstr_tok: ["The","collate","class","for","LibriSpeech","or","LibriLightLimited","dataset","."]
docstr: Args:
      batch (List(Tuple(Tensor, int, str, int, int, int))):
          The list of tuples that contains
          waveform, sample_rate, transcript, speaker_id, chapter_id, and utterance_id.
  
  Returns:
      (Tuple(Tensor, Tensor, Tensor, Tensor)):
          The Tensor of waveforms with dimensions `(batch, time)`.
          The Tensor of labels with dimensions `(batch, seq)`.
          The Tensor of audio lengths with dimensions `(batch,)`.
          The Tensor of length lengths with dimensions `(batch,)`.
docstr_tok: ["Args",":","batch","(","List","(","Tuple","(","Tensor",",","int",",","str",",","int",",","int",",","int",")",")",")",":","The","list","of","tuples","that","contains","waveform",",","sample_rate",",","transcript",",","speaker_id",",","chapter_id",",","and","utterance_id",".","Returns",":","(","Tuple","(","Tensor",",","Tensor",",","Tensor",",","Tensor",")",")",":","The","Tensor","of","waveforms","with","dimensions","`","(","batch",",","time",")","`",".","The","Tensor","of","labels","with","dimensions","`","(","batch",",","seq",")","`",".","The","Tensor","of","audio","lengths","with","dimensions","`","(","batch",",",")","`",".","The","Tensor","of","length","lengths","with","dimensions","`","(","batch",",",")","`","."]
code: def __call__(
      self, batch: List[Tuple[Tensor, int, str, int, int, int]]
  ) -> Tuple[Tensor, Tensor, Tensor]:
      """
      Args:
          batch (List(Tuple(Tensor, int, str, int, int, int))):
              The list of tuples that contains
              waveform, sample_rate, transcript, speaker_id, chapter_id, and utterance_id.
  
      Returns:
          (Tuple(Tensor, Tensor, Tensor, Tensor)):
              The Tensor of waveforms with dimensions `(batch, time)`.
              The Tensor of labels with dimensions `(batch, seq)`.
              The Tensor of audio lengths with dimensions `(batch,)`.
              The Tensor of length lengths with dimensions `(batch,)`.
  
      """
      audio_sizes = [sample[0].shape[1] for sample in batch]
      audio_size = max(audio_sizes)
      waveforms, labels, audio_lengths, label_lengths = [], [], [], []
      label2id = _get_label2id()
      for sample in batch:
          waveform, transcript = sample[0], sample[2]
          # add one "|" symbol after the end of transcription as the word termination
          transcript = transcript + "|"
          label = torch.tensor(
              [
                  label2id[e]
                  for e in transcript.replace(" ", "|").upper()
              ]
          )
          audio_length = waveform.size(1)
          label_length = label.size(0)
          waveforms.append(waveform)
          audio_lengths.append(audio_length)
          label_lengths.append(label_length)
          labels.append(label)
  
      data = torch.zeros(len(batch), audio_size)
      for i in range(len(waveforms)):
          data[i][0 : waveforms[i].shape[1]] = waveforms[i]
      audio_lengths = torch.tensor(audio_lengths)
      label_lengths = torch.tensor(label_lengths)
      labels = torch.nn.utils.rnn.pad_sequence(
          labels, batch_first=True, padding_value=-1
      )
      return (
          data,
          labels.int(),
          audio_lengths.int(),
          label_lengths.int(),
      )
  
imports: import math
  import os
  import sys
  from pathlib import Path
  from typing import Dict, Iterator, List, Optional, Tuple, Union
  import numpy
  import torch
  import torch.distributed
  import torchaudio
  from torch import Tensor
  from torch.utils.data import BatchSampler, Dataset, DistributedSampler
  from utils import _get_label2id
label_desc: Use image node_id 1 for calling the CollateFnLibriLightLimited obj's underlying member method code with example usage: obj.__call__(batch) and returns: data,  labels,  audio_lengths,  label_lengths