code: def prepare_libritts(
      data_folder,
      save_json_train,
      save_json_valid,
      save_json_test,
      sample_rate,
      split_ratio=[80, 10, 10],
      libritts_subsets=None,
      train_split=None,
      valid_split=None,
      test_split=None,
      seed=1234,
      model_name=None,
  ):
      """
      Prepares the json files for the LibriTTS dataset.
      Downloads the dataset if it is not found in the `data_folder` as expected.
  
      Arguments
      ---------
      data_folder : str
          Path to the folder where the LibriTTS dataset is stored.
      save_json_train : str
          Path where the train data specification file will be saved.
      save_json_valid : str
          Path where the validation data specification file will be saved.
      save_json_test : str
          Path where the test data specification file will be saved.
      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.
      sample_rate : int
          The sample rate to be used for the dataset
      libritts_subsets: list
          List of librispeech subsets to use (e.g., dev-clean, train-clean-100, ...) for the experiment.
          This parameter will be ignored if explicit data splits are provided.
          Explicit data splits parameters: "train_split", "valid_split", "test_split"
      train_split : list
          List of librispeech subsets to use (e.g.,train-clean-100, train-clean-360) for the experiment training stage.
      valid_split : list
          List of librispeech subsets to use (e.g., dev-clean) for the experiment validation stage.
      test_split : list
          List of librispeech subsets to use (e.g., test-clean) for the experiment testing stage.
      seed : int
          Seed value
      model_name : str
          Model name (used to prepare additional model specific data)
      """
  
      # Setting the seed value
      random.seed(seed)
  
      # Checks if this phase is already done (if so, skips it)
      if skip(save_json_train, save_json_valid, save_json_test):
          logger.info(
              "Preparation completed in previous run, skipping."
          )
          return
  
      logger.info(
          f"Creating {save_json_train}, {save_json_valid}, and {save_json_test}"
      )
  
      # If specific splits are provided, creates data manifest files accordingly
      if train_split:
          wav_list = prepare_split(data_folder, train_split)
          create_json(
              wav_list, save_json_train, sample_rate, model_name
          )
      if valid_split:
          wav_list = prepare_split(data_folder, valid_split)
          create_json(
              wav_list, save_json_valid, sample_rate, model_name
          )
      if test_split:
          wav_list = prepare_split(data_folder, test_split)
          create_json(wav_list, save_json_test, sample_rate, model_name)
  
      if skip(save_json_train, save_json_valid, save_json_test):
          logger.info("Preparation completed.")
          return
  
      # If specific splits are not provided, and a list of subsets if provided, creates train, valid, test splits
      # Creates data manifest files according to the data splits
      if libritts_subsets:
          wav_list = prepare_split(data_folder, libritts_subsets)
          # Random split the signal list into train, valid, and test sets.
          data_split = split_sets(wav_list, split_ratio)
          # Creating json files
          create_json(data_split["train"], save_json_train, sample_rate)
          create_json(data_split["valid"], save_json_valid, sample_rate)
          create_json(data_split["test"], save_json_test, sample_rate)
  
file_path: speechbrain/recipes/LibriTTS/TTS/mstacotron2/libritts_prepare.py
imports: from speechbrain.utils.data_utils import get_all_files, download_file
  import json
  import os
  import shutil
  import random
  import logging
  import torchaudio
  import torch
  from tqdm import tqdm
  from speechbrain.inference.txt import GraphemeToPhoneme
  from speechbrain.utils.text_to_sequence import _g2p_keep_punctuations
label_desc: Use image node_id 1 for calling a global function with example usage: prepare_libritts(data_folder, save_json_train, save_json_valid, save_json_test, sample_rate, split_ratio, libritts_subsets, train_split, valid_split, test_split, seed, model_name) without return types