code: def main(args) -> None:
      if args.verbose:
          logger.setLevel(logging.DEBUG)
  
      # get config for each layer
      logger.info(f"Using {args.config_file} as config file.")
      with open(args.config_file) as config_file:
          config = json.load(config_file)
  
      for layer, batch_size, gsm_mode in itertools.product(
          args.layers, args.batch_sizes, args.grad_sample_modes
      ):
          # skip benchmark for this layer and batch size if applicable
          if args.cont and exists(
              get_path(
                  layer=layer,
                  batch_size=batch_size,
                  num_runs=args.num_runs,
                  num_repeats=args.num_repeats,
                  random_seed=args.random_seed,
                  forward_only=args.forward_only,
                  root=args.root,
                  suffix=args.suffix,
                  gsm_mode=gsm_mode,
              )
          ):
              logger.info(
                  f"Skipping {layer} ({gsm_mode}) at {batch_size} - already exists."
              )
              continue
  
          try:
              # run and save (if applicable) the benchmark for this layer and batch size
              run_and_save_benchmark(
                  layer=layer,
                  batch_size=batch_size,
                  args=args,
                  layer_config=config[get_layer_set(layer)],
                  root=args.root,
                  suffix=args.suffix,
                  gsm_mode=gsm_mode,
              )
          except Exception as e:
              logger.info(
                  f"Skipping {layer} ({gsm_mode}) at {batch_size} - Failed with {e}"
              )
  
file_path: opacus/benchmarks/run_benchmarks.py
imports: import argparse
  import itertools
  import json
  import logging
  from os.path import exists
  from typing import Any, Dict
  from benchmarks.benchmark_layer import run_layer_benchmark
  from benchmarks.layers import LayerType
  from benchmarks.utils import get_layer_set, get_path, save_results
label_desc: Use image node_id 2 for calling a global function with example usage: main(args) without return types