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` 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. Adds noise, reverb, and babble on-the-fly.
      # Of course for a real enhancement dataset, you'd want a fixed valid set.
      @sb.utils.data_pipeline.takes("wav")
      @sb.utils.data_pipeline.provides("clean_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`."""
          clean_sig = sb.dataio.dataio.read_audio(wav)
          return clean_sig
  
      # Define datasets sorted by ascending lengths for efficiency
      datasets = {}
      data_info = {
          "train": hparams["train_annotation"],
          "valid": hparams["valid_annotation"],
          "test": hparams["test_annotation"],
      }
      hparams["dataloader_options"]["shuffle"] = False
      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", "clean_sig"],
          ).filtered_sorted(
              sort_key="length"
          )
      return datasets
  
file_path: speechbrain/templates/enhancement/train.py
imports: import sys
  import torch
  import speechbrain
  from hyperpyyaml import load_hyperpyyaml
  from mini_librispeech_prepare import prepare_mini_librispeech
label_desc: Use image node_id 1 for calling a global function with example usage: dataio_prep(hparams) and returns: datasets, clean_sig