code: def dataio_prepare(hparams):
      """This function prepares the datasets to be used in the brain class.
      It also defines the data processing pipeline through user-defined
      functions. We expect `prepare_mini_librispeech` to have been called before
      this, so that the `train.json`, `valid.json`,  and `valid.json` manifest
      files are available.
  
      Arguments
      ---------
      hparams : dict
          This dictionary is loaded from the `train.yaml` file, and it includes
          all the hyperparameters needed for dataset construction and loading.
  
      Returns
      -------
      datasets : dict
          Contains two keys, "train" and "valid" that correspond
          to the appropriate DynamicItemDataset object.
      """
  
      # Define audio pipeline
      @sb.utils.data_pipeline.takes("wav")
      @sb.utils.data_pipeline.provides("sig")
      def audio_pipeline(wav):
          """Load the signal, and pass it and its length to the corruption class.
          This is done on the CPU in the `collate_fn`."""
          sig = sb.dataio.dataio.read_audio(wav)
          info = torchaudio.info(wav)
          resampled = torchaudio.transforms.Resample(
              info.sample_rate,
              hparams["sample_rate"],
          )(sig)
          return resampled
  
      # Define datasets. We also connect the dataset with the data processing
      # functions defined above.
      datasets = {}
      data_info = {
          "train": hparams["train_annotation"],
      }
      for dataset in data_info:
          datasets[
              dataset
          ] = sb.dataio.dataset.DynamicItemDataset.from_json(
              json_path=data_info[dataset],
              replacements={"data_root": hparams["data_folder"]},
              dynamic_items=[audio_pipeline],
              output_keys=["id", "sig"],
          )
      # Load or compute the label encoder (with multi-GPU DDP support)
      # Please, take a look into the lab_enc_file to see the label to index
      # mappinng.
  
      return datasets["train"]
  
file_path: speechbrain/recipes/IEMOCAP/quantization/train.py
imports: import os
  import sys
  import logging
  import speechbrain
  from speechbrain.utils.distributed import run_on_main
  from hyperpyyaml import load_hyperpyyaml
  from torch.utils.data import DataLoader
  from speechbrain.dataio.dataloader import LoopedLoader
  from speechbrain.utils.kmeans import fetch_kmeans_model, train, save_model
  import torchaudio
label_desc: Use image node_id 1 for calling a global function with example usage: dataio_prepare(hparams) and returns: datasets, resampled