code: def main(cmd_args):
      """Run training."""
      parser = get_parser()
      args, _ = parser.parse_known_args(cmd_args)
  
      from espnet.utils.dynamic_import import dynamic_import
  
      model_class = dynamic_import(args.model_module)
      assert issubclass(model_class, TTSInterface)
      model_class.add_arguments(parser)
      args = parser.parse_args(cmd_args)
  
      # add version info in args
      args.version = __version__
  
      # logging info
      if args.verbose > 0:
          logging.basicConfig(
              level=logging.INFO,
              format="%(asctime)s (%(module)s:%(lineno)d) %(levelname)s: %(message)s",
          )
      else:
          logging.basicConfig(
              level=logging.WARN,
              format="%(asctime)s (%(module)s:%(lineno)d) %(levelname)s: %(message)s",
          )
          logging.warning("Skip DEBUG/INFO messages")
  
      # If --ngpu is not given,
      #   1. if CUDA_VISIBLE_DEVICES is set, all visible devices
      #   2. if nvidia-smi exists, use all devices
      #   3. else ngpu=0
      if args.ngpu is None:
          cvd = os.environ.get("CUDA_VISIBLE_DEVICES")
          if cvd is not None:
              ngpu = len(cvd.split(","))
          else:
              logging.warning("CUDA_VISIBLE_DEVICES is not set.")
              try:
                  p = subprocess.run(
                      ["nvidia-smi", "-L"],
                      stdout=subprocess.PIPE,
                      stderr=subprocess.PIPE,
                  )
              except (subprocess.CalledProcessError, FileNotFoundError):
                  ngpu = 0
              else:
                  ngpu = len(p.stderr.decode().split("\n")) - 1
          args.ngpu = ngpu
      else:
          ngpu = args.ngpu
      logging.info(f"ngpu: {ngpu}")
  
      # set random seed
      logging.info("random seed = %d" % args.seed)
      random.seed(args.seed)
      np.random.seed(args.seed)
  
      if args.backend == "pytorch":
          from espnet.tts.pytorch_backend.tts import train
  
          train(args)
      else:
          raise NotImplementedError("Only pytorch is supported.")
  
file_path: espnet/espnet/bin/tts_train.py
imports: import logging
  import os
  import random
  import subprocess
  import sys
  import configargparse
  import numpy
  from espnet import __version__
  from espnet.nets.tts_interface import TTSInterface
  from espnet.utils.cli_utils import strtobool
  from espnet.utils.training.batchfy import BATCH_COUNT_CHOICES
label_desc: Use image node_id 2 for calling a global function with example usage: main(cmd_args) without return types