code: def split_sets(data_folder, splits, split_ratio):
      """Randomly splits the wav list into training, validation, and test lists.
      Note that a better approach is to make sure that all the classes have the
      same proportion of samples for each session.
  
      Arguments
      ---------
      wav_list : list
          list of all the signals in the dataset
      split_ratio: list
          List composed of three integers that sets split ratios for train,
          valid, and test sets, respectively.
          For instance split_ratio=[80, 10, 10] will assign 80% of the sentences
          to training, 10% for validation, and 10% for test.
  
      Returns
      ------
      dictionary containing train, valid, and test splits.
      """
      meta_csv = os.path.join(data_folder, METADATA_CSV)
      csv_reader = csv.reader(
          open(meta_csv), delimiter="|", quoting=csv.QUOTE_NONE
      )
  
      meta_csv = list(csv_reader)
  
      index_for_sessions = []
      session_id_start = "LJ001"
      index_this_session = []
      for i in range(len(meta_csv)):
          session_id = meta_csv[i][0].split("-")[0]
          if session_id == session_id_start:
              index_this_session.append(i)
              if i == len(meta_csv) - 1:
                  index_for_sessions.append(index_this_session)
          else:
              index_for_sessions.append(index_this_session)
              session_id_start = session_id
              index_this_session = [i]
  
      session_len = [len(session) for session in index_for_sessions]
  
      data_split = {}
      for i, split in enumerate(splits):
          data_split[split] = []
          for j in range(len(index_for_sessions)):
              if split == "train":
                  random.shuffle(index_for_sessions[j])
                  n_snts = int(
                      session_len[j] * split_ratio[i] / sum(split_ratio)
                  )
                  data_split[split].extend(
                      index_for_sessions[j][0:n_snts]
                  )
                  del index_for_sessions[j][0:n_snts]
              if split == "valid":
                  if "test" in splits:
                      random.shuffle(index_for_sessions[j])
                      n_snts = int(
                          session_len[j]
                          * split_ratio[i]
                          / sum(split_ratio)
                      )
                      data_split[split].extend(
                          index_for_sessions[j][0:n_snts]
                      )
                      del index_for_sessions[j][0:n_snts]
                  else:
                      data_split[split].extend(index_for_sessions[j])
              if split == "test":
                  data_split[split].extend(index_for_sessions[j])
  
      return data_split, meta_csv
  
imports: import os
  import csv
  import json
  import random
  import logging
  import torch
  import torchaudio
  import numpy
  from tqdm import tqdm
  from speechbrain.utils.data_utils import download_file
  from speechbrain.dataio.dataio import load_pkl, save_pkl
  import tgt
  from speechbrain.inference.text import GraphemeToPhoneme
  import re
  from unidecode import unidecode
  from speechbrain.utils.text_to_sequence import _g2p_keep_punctuations
label_desc: Use image node_id 3 for calling a global function with example usage: split_sets(data_folder, splits, split_ratio) and returns: data_split,  meta_csv