code: def setup_loader(ap, r, verbose=False):
      tokenizer, _ = TTSTokenizer.init_from_config(c)
      dataset = TTSDataset(
          outputs_per_step=r,
          compute_linear_spec=False,
          samples=meta_data,
          tokenizer=tokenizer,
          ap=ap,
          batch_group_size=0,
          min_text_len=c.min_text_len,
          max_text_len=c.max_text_len,
          min_audio_len=c.min_audio_len,
          max_audio_len=c.max_audio_len,
          phoneme_cache_path=c.phoneme_cache_path,
          precompute_num_workers=0,
          use_noise_augment=False,
          verbose=verbose,
          speaker_id_mapping=speaker_manager.name_to_id
          if c.use_speaker_embedding
          else None,
          d_vector_mapping=speaker_manager.embeddings
          if c.use_d_vector_file
          else None,
      )
  
      if c.use_phonemes and c.compute_input_seq_cache:
          # precompute phonemes to have a better estimate of sequence lengths.
          dataset.compute_input_seq(c.num_loader_workers)
      dataset.preprocess_samples()
  
      loader = DataLoader(
          dataset,
          batch_size=c.batch_size,
          shuffle=False,
          collate_fn=dataset.collate_fn,
          drop_last=False,
          sampler=None,
          num_workers=c.num_loader_workers,
          pin_memory=False,
      )
      return loader
  
file_path: TTS/TTS/bin/extract_tts_spectrograms.py
imports: import argparse
  import os
  import numpy
  import torch
  from torch.utils.data import DataLoader
  from tqdm import tqdm
  from TTS.config import load_config
  from TTS.tts.datasets import TTSDataset, load_tts_samples
  from TTS.tts.models import setup_model
  from TTS.tts.utils.speakers import SpeakerManager
  from TTS.tts.utils.text.tokenizer import TTSTokenizer
  from TTS.utils.audio import AudioProcessor
  from TTS.utils.audio.numpy_transforms import quantize
  from TTS.utils.generic_utils import count_parameters
label_desc: Use image node_id 1 for calling a global function with example usage: setup_loader(ap, r, verbose) and returns: loader