code: def dataio_prepare(hparams):
      # Define audio pipeline:
      @sb.utils.data_pipeline.takes("wav", "label")
      @sb.utils.data_pipeline.provides("mel_text_pair")
      def audio_pipeline(wav, label):
          text_seq = torch.IntTensor(
              text_to_sequence(label, hparams["text_cleaners"])
          )
  
          audio = sb.dataio.dataio.read_audio(wav)
          mel = hparams["mel_spectogram"](audio=audio)
  
          len_text = len(text_seq)
  
          return text_seq, mel, len_text
  
      datasets = {}
      data_info = {
          "train": hparams["train_json"],
          "valid": hparams["valid_json"],
          "test": hparams["test_json"],
      }
      for dataset in hparams["splits"]:
          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=["mel_text_pair", "wav", "label"],
          )
  
      return datasets
  
file_path: speechbrain/recipes/LJSpeech/TTS/tacotron2/train.py
imports: import torch
  import speechbrain
  import sys
  import logging
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.text_to_sequence import text_to_sequence
  from speechbrain.utils.data_utils import scalarize
label_desc: Use image node_id 1 for calling a global function with example usage: dataio_prepare(hparams) and returns: datasets, text_seq,  mel,  len_text