code: def prepare_mini_librispeech(
      data_folder, save_json_train, save_json_valid, save_json_test
  ):
      """
      Prepares the json files for the Mini Librispeech dataset.
  
      Downloads the dataset if its not found in the `data_folder`.
  
      Arguments
      ---------
      data_folder : str
          Path to the folder where the Mini Librispeech 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.
  
      Example
      -------
      >>> data_folder = '/path/to/mini_librispeech'
      >>> prepare_mini_librispeech(data_folder, 'train.json', 'valid.json', 'test.json')
      """
  
      # Check if this phase is already done (if so, skip it)
      if skip(save_json_train, save_json_valid, save_json_test):
          logger.info(
              "Preparation completed in previous run, skipping."
          )
          return
  
      # If the dataset doesn't exist yet, download it
      train_folder = os.path.join(
          data_folder, "LibriSpeech", "train-clean-5"
      )
      valid_folder = os.path.join(
          data_folder, "LibriSpeech", "dev-clean-2"
      )
      test_folder = os.path.join(
          data_folder, "LibriSpeech", "test-clean"
      )
      if not check_folders(train_folder, valid_folder, test_folder):
          download_mini_librispeech(data_folder)
  
      # List files and create manifest from list
      logger.info(
          f"Creating {save_json_train}, {save_json_valid}, and {save_json_test}"
      )
      extension = [".flac"]
  
      # List of flac audio files
      wav_list_train = get_all_files(train_folder, match_and=extension)
      wav_list_valid = get_all_files(valid_folder, match_and=extension)
      wav_list_test = get_all_files(test_folder, match_and=extension)
  
      # List of transcription file
      extension = [".trans.txt"]
      trans_list = get_all_files(data_folder, match_and=extension)
      trans_dict = get_transcription(trans_list)
  
      # Create the json files
      create_json(wav_list_train, trans_dict, save_json_train)
      create_json(wav_list_valid, trans_dict, save_json_valid)
      create_json(wav_list_test, trans_dict, save_json_test)
  
file_path: speechbrain/tests/templates/fetching_ddp_dynbatch_finetuning/mini_librispeech_prepare.py
imports: import os
  import json
  import shutil
  import logging
  from speechbrain.utils.data_utils import get_all_files, download_file
  from speechbrain.dataio.dataio import read_audio
label_desc: Use image node_id 1 for calling a global function with example usage: prepare_mini_librispeech(data_folder, save_json_train, save_json_valid, save_json_test) without return types