code: def main(args):  # pylint: disable=redefined-outer-name
      # pylint: disable=global-variable-undefined
      global meta_data, speaker_manager
  
      # Audio processor
      ap = AudioProcessor(**c.audio)
  
      # load data instances
      meta_data_train, meta_data_eval = load_tts_samples(
          c.datasets,
          eval_split=args.eval,
          eval_split_max_size=c.eval_split_max_size,
          eval_split_size=c.eval_split_size,
      )
  
      # use eval and training partitions
      meta_data = meta_data_train + meta_data_eval
  
      # init speaker manager
      if c.use_speaker_embedding:
          speaker_manager = SpeakerManager(data_items=meta_data)
      elif c.use_d_vector_file:
          speaker_manager = SpeakerManager(
              d_vectors_file_path=c.d_vector_file
          )
      else:
          speaker_manager = None
  
      # setup model
      model = setup_model(c)
  
      # restore model
      model.load_checkpoint(c, args.checkpoint_path, eval=True)
  
      if use_cuda:
          model.cuda()
  
      num_params = count_parameters(model)
      print(
          "\n > Model has {} parameters".format(num_params), flush=True
      )
      # set r
      r = 1 if c.model.lower() == "glow_tts" else model.decoder.r
      own_loader = setup_loader(ap, r, verbose=True)
  
      extract_spectrograms(
          own_loader,
          model,
          ap,
          args.output_path,
          quantize_bits=args.quantize_bits,
          save_audio=args.save_audio,
          debug=args.debug,
          metada_name="metada.txt",
      )
  
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 6 for calling a global function with example usage: main(args) without return types