code: def main():
      parser = argparse.ArgumentParser(
          description="""StyleGAN2 generator.
  
  Run 'python %(prog)s <subcommand> --help' for subcommand help.""",
          epilog=_examples,
          formatter_class=argparse.RawDescriptionHelpFormatter,
      )
  
      subparsers = parser.add_subparsers(
          help="Sub-commands", dest="command"
      )
  
      parser_generate_images = subparsers.add_parser(
          "generate-images", help="Generate images"
      )
      parser_generate_images.add_argument(
          "--network",
          help="Network pickle filename",
          dest="network_pkl",
          required=True,
      )
      parser_generate_images.add_argument(
          "--seeds",
          type=_parse_num_range,
          help="List of random seeds",
          required=True,
      )
      parser_generate_images.add_argument(
          "--truncation-psi",
          type=float,
          help="Truncation psi (default: %(default)s)",
          default=0.5,
      )
      parser_generate_images.add_argument(
          "--result-dir",
          help="Root directory for run results (default: %(default)s)",
          default="results",
          metavar="DIR",
      )
  
      parser_style_mixing_example = subparsers.add_parser(
          "style-mixing-example", help="Generate style mixing video"
      )
      parser_style_mixing_example.add_argument(
          "--network",
          help="Network pickle filename",
          dest="network_pkl",
          required=True,
      )
      parser_style_mixing_example.add_argument(
          "--row-seeds",
          type=_parse_num_range,
          help="Random seeds to use for image rows",
          required=True,
      )
      parser_style_mixing_example.add_argument(
          "--col-seeds",
          type=_parse_num_range,
          help="Random seeds to use for image columns",
          required=True,
      )
      parser_style_mixing_example.add_argument(
          "--col-styles",
          type=_parse_num_range,
          help="Style layer range (default: %(default)s)",
          default="0-6",
      )
      parser_style_mixing_example.add_argument(
          "--truncation-psi",
          type=float,
          help="Truncation psi (default: %(default)s)",
          default=0.5,
      )
      parser_style_mixing_example.add_argument(
          "--result-dir",
          help="Root directory for run results (default: %(default)s)",
          default="results",
          metavar="DIR",
      )
  
      args = parser.parse_args()
      kwargs = vars(args)
      subcmd = kwargs.pop("command")
  
      if subcmd is None:
          print(
              "Error: missing subcommand.  Re-run with --help for usage."
          )
          sys.exit(1)
  
      sc = dnnlib.SubmitConfig()
      sc.num_gpus = 1
      sc.submit_target = dnnlib.SubmitTarget.LOCAL
      sc.local.do_not_copy_source_files = True
      sc.run_dir_root = kwargs.pop("result_dir")
      sc.run_desc = subcmd
  
      func_name_map = {
          "generate-images": "run_generator.generate_images",
          "style-mixing-example": "run_generator.style_mixing_example",
      }
      dnnlib.submit_run(sc, func_name_map[subcmd], **kwargs)
  
file_path: insightface/reconstruction/ostec/external/stylegan2/run_generator.py
imports: import argparse
  import numpy
  import PIL.Image
  import dnnlib
  import dnnlib.tflib
  import re
  import sys
  import pretrained_networks
label_desc: Use image node_id 4 for calling a global function with example usage: main() without return types