code: def main(args):  # pylint: disable=redefined-outer-name
      # pylint: disable=global-variable-undefined
      global meta_data_train
      global meta_data_eval
  
      ap = AudioProcessor(**c.audio)
      model = SpeakerEncoder(
          input_dim=c.model["input_dim"],
          proj_dim=c.model["proj_dim"],
          lstm_dim=c.model["lstm_dim"],
          num_lstm_layers=c.model["num_lstm_layers"],
      )
      optimizer = RAdam(model.parameters(), lr=c.lr)
  
      if c.loss == "ge2e":
          criterion = GE2ELoss(loss_method="softmax")
      elif c.loss == "angleproto":
          criterion = AngleProtoLoss()
      else:
          raise Exception("The %s  not is a loss supported" % c.loss)
  
      if args.restore_path:
          checkpoint = torch.load(args.restore_path)
          try:
              # TODO: fix optimizer init, model.cuda() needs to be called before
              # optimizer restore
              # optimizer.load_state_dict(checkpoint['optimizer'])
              if c.reinit_layers:
                  raise RuntimeError
              model.load_state_dict(checkpoint["model"])
          except KeyError:
              print(" > Partial model initialization.")
              model_dict = model.state_dict()
              model_dict = set_init_dict(model_dict, checkpoint, c)
              model.load_state_dict(model_dict)
              del model_dict
          for group in optimizer.param_groups:
              group["lr"] = c.lr
          print(
              " > Model restored from step %d" % checkpoint["step"],
              flush=True,
          )
          args.restore_step = checkpoint["step"]
      else:
          args.restore_step = 0
  
      if use_cuda:
          model = model.cuda()
          criterion.cuda()
  
      if c.lr_decay:
          scheduler = NoamLR(
              optimizer,
              warmup_steps=c.warmup_steps,
              last_epoch=args.restore_step - 1,
          )
      else:
          scheduler = None
  
      num_params = count_parameters(model)
      print(
          "\n > Model has {} parameters".format(num_params), flush=True
      )
  
      # pylint: disable=redefined-outer-name
      meta_data_train, meta_data_eval = load_meta_data(c.datasets)
  
      global_step = args.restore_step
      _, global_step = train(
          model, criterion, optimizer, scheduler, ap, global_step
      )
  
imports: import argparse
  import os
  import sys
  import time
  import traceback
  import torch
  from torch.utils.data import DataLoader
  from TTS.speaker_encoder.dataset import MyDataset
  from TTS.speaker_encoder.losses import AngleProtoLoss, GE2ELoss
  from TTS.speaker_encoder.model import SpeakerEncoder
  from TTS.speaker_encoder.utils.generic_utils import check_config_speaker_encoder, save_best_model
  from TTS.speaker_encoder.utils.visual import plot_embeddings
  from TTS.tts.datasets.preprocess import load_meta_data
  from TTS.utils.audio import AudioProcessor
  from TTS.utils.generic_utils import count_parameters, create_experiment_folder, get_git_branch, remove_experiment_folder, set_init_dict
  from TTS.utils.io import copy_model_files, load_config
  from TTS.utils.radam import RAdam
  from TTS.utils.tensorboard_logger import TensorboardLogger
  from TTS.utils.training import NoamLR, check_update
label_desc: Use image node_id 3 for calling a global function with example usage: main(args) without return types