code: def dataio_prep(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)
          return sig
  
      label_encoder = sb.dataio.encoder.CategoricalEncoder()
  
      # Define label pipeline:
      @sb.utils.data_pipeline.takes("frame_label")
      @sb.utils.data_pipeline.provides("emo_encoded")
      def label_pipeline(frame_label):
          emo_encoded = label_encoder.encode_sequence_torch(frame_label)
          yield emo_encoded
  
      datasets = {}
      for dataset in ["train", "valid", "test"]:
          datasets[
              dataset
          ] = sb.dataio.dataset.DynamicItemDataset.from_json(
              json_path=hparams[f"{dataset}_annotation"],
              replacements={"data_root": hparams["zed_folder"]},
              dynamic_items=[audio_pipeline, label_pipeline],
              output_keys=["id", "sig", "emo_encoded"],
          )
  
      lab_enc_file = os.path.join(
          hparams["save_folder"], "label_encoder.txt"
      )
  
      label_encoder.load_or_create(
          path=lab_enc_file,
          from_didatasets=[datasets["train"]],
          output_key="frame_label",
          sequence_input=True,
      )
  
      return datasets, label_encoder
  
file_path: speechbrain/recipes/ZaionEmotionDataset/emotion_diarization/train.py
imports: import os
  import sys
  import speechbrain
  from hyperpyyaml import load_hyperpyyaml
  import torch
  import json
  import itertools
  from speechbrain.utils.EDER import EDER
label_desc: Use image node_id 1 for calling a global function with example usage: dataio_prep(hparams) and returns: datasets,  label_encoder, sig