code: def data_prep(data_folder, hparams):
      "Creates the datasets and their data processing pipelines."
  
      # 1. Declarations:
      train_data = sb.dataio.dataset.DynamicItemDataset.from_json(
          json_path=data_folder / "../annotation/ASR_train.json",
          replacements={"data_root": data_folder},
      )
      valid_data = sb.dataio.dataset.DynamicItemDataset.from_json(
          json_path=data_folder / "../annotation/ASR_dev.json",
          replacements={"data_root": data_folder},
      )
      datasets = [train_data, valid_data]
      label_encoder = sb.dataio.encoder.CTCTextEncoder()
      label_encoder.expect_len(hparams["num_labels"])
  
      # 2. Define audio pipeline:
      @sb.utils.data_pipeline.takes("wav")
      @sb.utils.data_pipeline.provides("sig")
      def audio_pipeline(wav):
          sig = sb.dataio.dataio.read_audio(wav)
          return sig
  
      sb.dataio.dataset.add_dynamic_item(datasets, audio_pipeline)
  
      # 3. Define text pipeline:
      @sb.utils.data_pipeline.takes("phn")
      @sb.utils.data_pipeline.provides("phn_list", "phn_encoded")
      def text_pipeline(phn):
          phn_list = phn.strip().split()
          yield phn_list
          phn_encoded = label_encoder.encode_sequence_torch(phn_list)
          yield phn_encoded
  
      sb.dataio.dataset.add_dynamic_item(datasets, text_pipeline)
  
      # 3. Fit encoder:
      # NOTE: In this minimal example, also update from valid data
      label_encoder.insert_blank(index=hparams["blank_index"])
      label_encoder.update_from_didataset(
          train_data, output_key="phn_list"
      )
      label_encoder.update_from_didataset(
          valid_data, output_key="phn_list"
      )
  
      # 4. Set output:
      sb.dataio.dataset.set_output_keys(
          datasets, ["id", "sig", "phn_encoded"]
      )
  
      return train_data, valid_data
  
file_path: speechbrain/tests/integration/ASR_CTC/example_asr_ctc_experiment_quaternion_net.py
imports: import pathlib
  import speechbrain
  from hyperpyyaml import load_hyperpyyaml
label_desc: Use image node_id 1 for calling a global function with example usage: data_prep(data_folder, hparams) and returns: train_data,  valid_data, sig