code: def split_process_dataset(
      dataset: str,
      file_path: str,
      val_ratio: float,
      transforms: Callable,
      text_preprocessor: Callable[[str], List[int]],
  ) -> Tuple[torch.utils.data.Dataset, torch.utils.data.Dataset]:
      """Returns the Training and validation datasets.
  
      Args:
          dataset (str): The dataset to use. Available options: [`'ljspeech'`]
          file_path (str): Path to the data.
          val_ratio (float): Path to the data.
          transforms (callable): A function/transform that takes in a waveform and
              returns a transformed waveform (mel spectrogram in this example).
          text_preprocess (callable): A function that takes in a string and
              returns a list of integers representing each of the symbol in the string.
  
      Returns:
          train_dataset (`torch.utils.data.Dataset`): The training set.
          val_dataset (`torch.utils.data.Dataset`): The validation set.
      """
      if dataset == "ljspeech":
          data = LJSPEECH(root=file_path, download=False)
  
          val_length = int(len(data) * val_ratio)
          lengths = [len(data) - val_length, val_length]
          train_dataset, val_dataset = random_split(data, lengths)
      else:
          raise ValueError(
              f"Expected datasets: `ljspeech`, but found {dataset}"
          )
  
      train_dataset = Processed(
          train_dataset, transforms, text_preprocessor
      )
      val_dataset = Processed(
          val_dataset, transforms, text_preprocessor
      )
  
      train_dataset = MapMemoryCache(train_dataset)
      val_dataset = MapMemoryCache(val_dataset)
  
      return train_dataset, val_dataset
  
imports: from typing import Callable, List, Tuple
  import torch
  from torch import Tensor
  from torch.utils.data.dataset import random_split
  from torchaudio.datasets import LJSPEECH
label_desc: Use image node_id 1 for calling a global function with example usage: split_process_dataset(dataset, file_path, val_ratio, transforms, text_preprocessor) and returns: train_dataset,  val_dataset