code: def parse_args():
      import argparse
  
      parser = argparse.ArgumentParser()
  
      parser.add_argument(
          "--data-root", type=str, help="Root of data directory"
      )
      parser.add_argument(
          "--file-type",
          default="image",
          type=str,
          help="Input file type; choose from: ['image', 'parquet']",
      )
      parser.add_argument(
          "--skip-train-model",
          default=False,
          action="store_true",
          help="Whether to skip training a model (i.e. only consume data). "
          "Set to True if file_type == 'parquet'.",
      )
      parser.add_argument(
          "--repeat-ds",
          default=1,
          type=int,
          help="Read the input dataset n times, used to increase the total data size.",
      )
      parser.add_argument(
          "--target-worker-gb",
          default=10,
          type=int,
          help=(
              "Number of GB per worker for selecting a subset "
              "from default dataset. -1 means the whole dataset"
          ),
      )
      parser.add_argument(
          "--batch-size",
          default=32,
          type=int,
          help="Batch size to use.",
      )
      parser.add_argument(
          "--num-epochs",
          # Use 5 epochs and report the avg per-epoch throughput
          # (excluding first epoch in case there is warmup).
          default=5,
          type=int,
          help="Number of epochs to run. The avg per-epoch throughput will be reported.",
      )
      parser.add_argument(
          "--num-retries",
          default=3,
          type=int,
          help="Number of retries for the Traine before exiting the benchmark.",
      )
      parser.add_argument(
          "--num-workers",
          default=1,
          type=int,
          help="Number of workers.",
      )
      parser.add_argument(
          "--use-gpu",
          action="store_true",
          default=False,
          help="Whether to use GPU with TorchTrainer.",
      )
      parser.add_argument(
          "--preserve-order",
          action="store_true",
          default=False,
          help="Whether to configure Train with preserve_order flag.",
      )
      parser.add_argument(
          "--use-torch",
          action="store_true",
          default=False,
          help="Whether to use PyTorch DataLoader.",
      )
      parser.add_argument(
          "--use-mosaic",
          action="store_true",
          default=False,
          help="",
      )
      parser.add_argument(
          "--use-synthetic-data",
          action="store_true",
          default=False,
          help=(
              "Whether to use synthetic Torch data (repeat a "
              "randomly generated batch 1000 times)"
          ),
      )
      parser.add_argument(
          "--torch-num-workers",
          default=None,
          type=int,
      )
      parser.add_argument(
          "--split-input",
          action="store_true",
          default=False,
          help="Whether to pre-split the input dataset instead of using streaming split.",
      )
      parser.add_argument(
          "--cache-input-ds",
          action="store_true",
          default=False,
          help="Whether to cache input dataset (before preprocessing).",
      )
      parser.add_argument(
          "--cache-output-ds",
          action="store_true",
          default=False,
          help="Whether to cache output dataset (after preprocessing).",
      )
      args = parser.parse_args()
  
      ray.init(
          runtime_env={
              "working_dir": os.path.dirname(__file__),
          }
      )
  
      if not (
          args.use_torch or args.use_mosaic or args.use_synthetic_data
      ):
          args.use_ray_data = True
      else:
          args.use_ray_data = False
  
      if args.data_root is None and not args.use_mosaic:
          # use default datasets if data root is not provided
          if args.file_type == "image":
              args.data_root = IMG_S3_ROOT
          elif args.file_type == "parquet":
              args.data_root = get_prop_parquet_paths(
                  num_workers=args.num_workers,
                  target_worker_gb=args.target_worker_gb,
              )
          else:
              raise Exception(
                  f"Unknown file type {args.file_type}; "
                  "expected one of: ['image', 'parquet']"
              )
          if args.repeat_ds > 1:
              args.data_root = [args.data_root] * args.repeat_ds
      if (
          args.file_type == "parquet"
          or args.use_torch
          or args.use_mosaic
      ):
          # Training model is only supported for images currently.
          # Parquet files do not have labels.
          args.skip_train_model = True
      return args
  
imports: import ray
  from ray import train
  from ray.train import DataConfig, ScalingConfig, RunConfig, Checkpoint
  from ray.train.torch import TorchTrainer
  from ray.data.datasource.partitioning import Partitioning
  import tempfile
  import itertools
  import os
  import time
  from benchmark import Benchmark, BenchmarkMetric
  from image_loader_microbenchmark import get_transform, crop_and_flip_image, decode_image_crop_and_flip, center_crop_image
  from image_loader_microbenchmark import get_mosaic_dataloader
  import torch
  import torch.distributed
  from torchvision.models import resnet50
  from torchvision.transforms.functional import pil_to_tensor
  import torch.nn
  import torch.optim
  from dataset_benchmark_util import get_prop_parquet_paths, IMG_S3_ROOT, get_mosaic_epoch_size, IMAGENET_WNID_TO_ID
label_desc: Use image node_id 1 for calling a global function with example usage: parse_args() and returns: args