code: def main():
      setup_default_logging()
      args = parser.parse_args()
      model_cfgs = []
      model_names = []
  
      if args.fast_norm:
          set_fast_norm()
  
      if args.model_list:
          args.model = ""
          with open(args.model_list) as f:
              model_names = [line.rstrip() for line in f]
          model_cfgs = [(n, None) for n in model_names]
      elif args.model == "all":
          # validate all models in a list of names with pretrained checkpoints
          args.pretrained = True
          model_names = list_models(
              pretrained=True, exclude_filters=["*in21k"]
          )
          model_cfgs = [(n, None) for n in model_names]
      elif not is_model(args.model):
          # model name doesn't exist, try as wildcard filter
          model_names = list_models(args.model)
          model_cfgs = [(n, None) for n in model_names]
  
      if len(model_cfgs):
          _logger.info(
              "Running bulk validation on these pretrained models: {}".format(
                  ", ".join(model_names)
              )
          )
          results = []
          try:
              for m, _ in model_cfgs:
                  if not m:
                      continue
                  args.model = m
                  r = benchmark(args)
                  if r:
                      results.append(r)
                  time.sleep(10)
          except KeyboardInterrupt as e:
              pass
          sort_key = "infer_samples_per_sec"
          if "train" in args.bench:
              sort_key = "train_samples_per_sec"
          elif "profile" in args.bench:
              sort_key = "infer_gmacs"
          results = filter(lambda x: sort_key in x, results)
          results = sorted(
              results, key=lambda x: x[sort_key], reverse=True
          )
      else:
          results = benchmark(args)
  
      if args.results_file:
          write_results(
              args.results_file, results, format=args.results_format
          )
  
      # output results in JSON to stdout w/ delimiter for runner script
      print(f"--result\n{json.dumps(results, indent=4)}")
  
imports: import argparse
  import csv
  import json
  import logging
  import time
  from collections import OrderedDict
  from contextlib import suppress
  from functools import partial
  import torch
  import torch.nn
  import torch.nn.parallel
  from timm.data import resolve_data_config
  from timm.layers import set_fast_norm
  from timm.models import create_model, is_model, list_models
  from timm.optim import create_optimizer_v2
  from timm.utils import setup_default_logging, set_jit_fuser, decay_batch_step, check_batch_size_retry, ParseKwargs, reparameterize_model
label_desc: Use image node_id 9 for calling a global function with example usage: main() without return types