code: def dataio_prep(hparams, token_encoder):
      """Creates the datasets and their data processing pipelines"""
  
      # Define pipelines
      @sb.utils.data_pipeline.takes("noisy_wav", "clean_wav")
      @sb.utils.data_pipeline.provides("noisy_sig", "clean_sig")
      def audio_pipeline(noisy_wav, clean_wav):
          yield sb.dataio.dataio.read_audio(noisy_wav)
          yield sb.dataio.dataio.read_audio(clean_wav)
  
      token_keys = ["tokens_bos", "tokens_eos", "tokens"]
  
      @sb.utils.data_pipeline.takes(hparams["target_type"])
      @sb.utils.data_pipeline.provides(
          "tokens_list", *[t for t in token_keys]
      )
      def target_pipeline(target):
          if "tokenizer" in hparams:
              tokens_list = token_encoder.encode_as_ids(target)
              yield tokens_list
          else:
              tokens_list = target.strip().split()
              yield tokens_list
              tokens_list = token_encoder.encode_sequence(tokens_list)
          tokens_bos = torch.LongTensor(
              [hparams["bos_index"]] + (tokens_list)
          )
          yield tokens_bos
          tokens_eos = torch.LongTensor(
              tokens_list + [hparams["eos_index"]]
          )
          yield tokens_eos
          tokens = torch.LongTensor(tokens_list)
          yield tokens
  
      # Create datasets
      data = {}
      data_info = {
          "train": hparams["train_annotation"],
          "valid": hparams["valid_annotation"],
          "test": hparams["test_annotation"],
      }
      for dataset in data_info:
          data[
              dataset
          ] = sb.dataio.dataset.DynamicItemDataset.from_json(
              json_path=data_info[dataset],
              replacements={"data_root": hparams["data_folder"]},
              dynamic_items=[audio_pipeline, target_pipeline],
              output_keys=["id", "noisy_sig", "clean_sig"] + token_keys,
          )
          if dataset != "train":
              data[dataset] = data[dataset].filtered_sorted(
                  sort_key="length"
              )
  
      # Sort train dataset and ensure it doesn't get un-sorted
      if (
          hparams["sorting"] == "ascending"
          or hparams["sorting"] == "descending"
      ):
          data["train"] = data["train"].filtered_sorted(
              sort_key="length",
              reverse=hparams["sorting"] == "descending",
          )
          hparams["train_loader_options"]["shuffle"] = False
      elif hparams["sorting"] != "random":
          raise NotImplementedError(
              "Sorting must be random, ascending, or descending"
          )
  
      # Update token_encoder
      if "tokenizer" not in hparams:
          token_encoder.insert_blank()
          token_encoder.update_from_didataset(
              data["train"], output_key="tokens_list"
          )
  
      return data
  
imports: import os
  import sys
  import torch
  import torchaudio
  import logging
  import speechbrain
  from pesq import pesq
  from pystoi import stoi
  from composite_eval import eval_composite
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.data_utils import undo_padding
  from speechbrain.utils.distributed import run_on_main, if_main_process
label_desc: Use image node_id 4 for calling a global function with example usage: dataio_prep(hparams, token_encoder) and returns: data