code: def main():
      parser = argparse.ArgumentParser(
          description="Train StyleGAN2.",
          epilog=_examples,
          formatter_class=argparse.RawDescriptionHelpFormatter,
      )
      parser.add_argument(
          "--result-dir",
          help="Root directory for run results (default: %(default)s)",
          default="results",
          metavar="DIR",
      )
      parser.add_argument(
          "--data-dir", help="Dataset root directory", required=True
      )
      parser.add_argument(
          "--dataset", help="Training dataset", required=True
      )
      parser.add_argument(
          "--config",
          help="Training config (default: %(default)s)",
          default="config-f",
          required=True,
          dest="config_id",
          metavar="CONFIG",
      )
      parser.add_argument(
          "--num-gpus",
          help="Number of GPUs (default: %(default)s)",
          default=1,
          type=int,
          metavar="N",
      )
      parser.add_argument(
          "--total-kimg",
          help="Training length in thousands of images (default: %(default)s)",
          metavar="KIMG",
          default=25000,
          type=int,
      )
      parser.add_argument(
          "--gamma",
          help="R1 regularization weight (default is config dependent)",
          default=None,
          type=float,
      )
      parser.add_argument(
          "--mirror-augment",
          help="Mirror augment (default: %(default)s)",
          default=False,
          metavar="BOOL",
          type=_str_to_bool,
      )
      parser.add_argument(
          "--metrics",
          help='Comma-separated list of metrics or "none" (default: %(default)s)',
          default="fid50k",
          type=_parse_comma_sep,
      )
  
      args = parser.parse_args()
  
      if not os.path.exists(args.data_dir):
          print("Error: dataset root directory does not exist.")
          sys.exit(1)
  
      if args.config_id not in _valid_configs:
          print(
              "Error: --config value must be one of: ",
              ", ".join(_valid_configs),
          )
          sys.exit(1)
  
      for metric in args.metrics:
          if metric not in metric_defaults:
              print("Error: unknown metric '%s'" % metric)
              sys.exit(1)
  
      run(**vars(args))
  
file_path: insightface/reconstruction/ostec/external/stylegan2/run_training.py
imports: import argparse
  import copy
  import os
  import sys
  import dnnlib
  from dnnlib import EasyDict
  from metrics.metric_defaults import metric_defaults
label_desc: Use image node_id 4 for calling a global function with example usage: main() without return types