class_docstr: Dataset that loads tensors via a json file containing paths to audio files,
  labels, and durations and offsets(in seconds). Each new line is a
  different sample. Example below:
  and their target labels. JSON files should be of the following format::
      {"audio_filepath": "/path/to/audio_wav_0.wav", "duration": time_in_sec_0, "label": target_label_0, "offset": offset_in_sec_0}
      ...
      {"audio_filepath": "/path/to/audio_wav_n.wav", "duration": time_in_sec_n, "label": target_label_n, "offset": offset_in_sec_n}
  Args:
      manifest_filepath (Union[str, List[str]]): Dataset parameter. Path to JSON containing data.
      labels (list): Dataset parameter. List of target classes that can be output by the speaker recognition model.
      featurizer
      min_duration (float): Dataset parameter. All training files which have a duration less than min_duration
          are dropped. Note: Duration is read from the manifest JSON.
          Defaults to 0.1.
      max_duration (float): Dataset parameter.
          All training files which have a duration more than max_duration
          are dropped. Note: Duration is read from the manifest JSON.
          Defaults to None.
      trim (bool): Whether to use trim silence from beginning and end of audio signal using librosa.effects.trim().
          Defaults to False.
class_docstr_tok: ["Dataset","that","loads","tensors","via","a","json","file","containing","paths","to","audio","files",",","labels",",","and","durations","and","offsets","(","in","seconds",")",".","Each","new","line","is","a","different","sample",".","Example","below",":","and","their","target","labels",".","JSON","files","should","be","of","the","following","format",":",":","{","``","audio_filepath","''",":","``","\/path\/to\/audio_wav_0.wav","''",",","``","duration","''",":","time_in_sec_0",",","``","label","''",":","target_label_0",",","``","offset","''",":","offset_in_sec_0","}","...","{","``","audio_filepath","''",":","``","\/path\/to\/audio_wav_n.wav","''",",","``","duration","''",":","time_in_sec_n",",","``","label","''",":","target_label_n",",","``","offset","''",":","offset_in_sec_n","}","Args",":","manifest_filepath","(","Union","[","str",",","List","[","str","]","]",")",":","Dataset","parameter",".","Path","to","JSON","containing","data",".","labels","(","list",")",":","Dataset","parameter",".","List","of","target","classes","that","can","be","output","by","the","speaker","recognition","model",".","featurizer","min_duration","(","float",")",":","Dataset","parameter",".","All","training","files","which","have","a","duration","less","than","min_duration","are","dropped",".","Note",":","Duration","is","read","from","the","manifest","JSON",".","Defaults","to","0.1.","max_duration","(","float",")",":","Dataset","parameter",".","All","training","files","which","have","a","duration","more","than","max_duration","are","dropped",".","Note",":","Duration","is","read","from","the","manifest","JSON",".","Defaults","to","None",".","trim","(","bool",")",":","Whether","to","use","trim","silence","from","beginning","and","end","of","audio","signal","using","librosa.effects.trim","(",")",".","Defaults","to","False","."]
code: def __init__(
      self,
      *,
      manifest_filepath: Union[str, List[str]],
      labels: List[str],
      featurizer,
      min_duration: Optional[float] = 0.1,
      max_duration: Optional[float] = None,
      trim: bool = False,
      is_regression_task: bool = False,
      cal_labels_occurrence: Optional[bool] = False,
  ):
      super().__init__()
      if isinstance(manifest_filepath, str):
          manifest_filepath = manifest_filepath.split(",")
      cache_datastore_manifests(
          manifest_filepaths=manifest_filepath, cache_audio=True
      )
      self.collection = collections.ASRSpeechLabel(
          manifests_files=manifest_filepath,
          min_duration=min_duration,
          max_duration=max_duration,
          is_regression_task=is_regression_task,
          cal_labels_occurrence=cal_labels_occurrence,
      )
  
      self.featurizer = featurizer
      self.trim = trim
      self.is_regression_task = is_regression_task
  
      if not is_regression_task:
          self.labels = (
              labels if labels else self.collection.uniq_labels
          )
          self.num_classes = (
              len(self.labels) if self.labels is not None else 1
          )
          self.label2id, self.id2label = {}, {}
          self.id2occurrence, self.labels_occurrence = {}, []
  
          for label_id, label in enumerate(self.labels):
              self.label2id[label] = label_id
              self.id2label[label_id] = label
              if cal_labels_occurrence:
                  self.id2occurrence[
                      label_id
                  ] = self.collection.labels_occurrence[label]
  
          if cal_labels_occurrence:
              self.labels_occurrence = [
                  self.id2occurrence[k]
                  for k in sorted(self.id2occurrence)
              ]
  
          for idx in range(len(self.labels[:5])):
              logging.debug(
                  " label id {} and its mapped label {}".format(
                      idx, self.id2label[idx]
                  )
              )
  
      else:
          self.labels = []
          self.num_classes = 1
  
imports: import io
  import os
  from typing import Dict, List, Optional, Union
  import torch
  import webdataset
  from nemo.collections.asr.data.audio_to_text import cache_datastore_manifests, expand_sharded_filepaths
  from nemo.collections.asr.parts.preprocessing.features import WaveformFeaturizer
  from nemo.collections.asr.parts.preprocessing.segment import available_formats
  from nemo.collections.common.parts.preprocessing import collections
  from nemo.core.classes import Dataset, IterableDataset
  from nemo.core.neural_types import AudioSignal, LabelsType, LengthsType, NeuralType, RegressionValuesType
  from nemo.utils import logging
label_desc: Use image node_id 2 to create a new _AudioLabelDataset object from inherited base classes: Dataset with example: obj = _AudioLabelDataset()