code: def get_args_parser(add_help=True):
      parser = argparse.ArgumentParser(
          add_help=add_help,
          description="Train or evaluate an optical-flow model.",
      )
      parser.add_argument(
          "--name",
          default="raft",
          type=str,
          help="The name of the experiment - determines the name of the files where weights are saved.",
      )
      parser.add_argument(
          "--output-dir",
          default=".",
          type=str,
          help="Output dir where checkpoints will be stored.",
      )
      parser.add_argument(
          "--resume",
          type=str,
          help="A path to previously saved weights. Used to re-start training from, or evaluate a pre-saved model.",
      )
  
      parser.add_argument(
          "--workers",
          type=int,
          default=12,
          help="Number of workers for the data loading part.",
      )
  
      parser.add_argument(
          "--train-dataset",
          type=str,
          help="The dataset to use for training. If not passed, only validation is performed (and you probably want to pass --resume).",
      )
      parser.add_argument(
          "--val-dataset",
          type=str,
          nargs="+",
          help="The dataset(s) to use for validation.",
      )
      parser.add_argument(
          "--val-freq",
          type=int,
          default=2,
          help="Validate every X epochs",
      )
      parser.add_argument(
          "--epochs",
          type=int,
          default=20,
          help="The total number of epochs to train.",
      )
      parser.add_argument("--batch-size", type=int, default=2)
  
      parser.add_argument(
          "--lr",
          type=float,
          default=0.00002,
          help="Learning rate for AdamW optimizer",
      )
      parser.add_argument(
          "--weight-decay",
          type=float,
          default=0.00005,
          help="Weight decay for AdamW optimizer",
      )
      parser.add_argument(
          "--adamw-eps",
          type=float,
          default=1e-8,
          help="eps value for AdamW optimizer",
      )
  
      parser.add_argument(
          "--freeze-batch-norm",
          action="store_true",
          help="Set BatchNorm modules of the model in eval mode.",
      )
  
      parser.add_argument(
          "--model",
          type=str,
          default="raft_large",
          help="The name of the model to use - either raft_large or raft_small",
      )
      # TODO: resume and weights should be in an exclusive arg group
  
      parser.add_argument(
          "--num_flow_updates",
          type=int,
          default=12,
          help="number of updates (or 'iters') in the update operator of the model.",
      )
  
      parser.add_argument(
          "--gamma",
          type=float,
          default=0.8,
          help="exponential weighting for loss. Must be < 1.",
      )
  
      parser.add_argument(
          "--dist-url",
          default="env://",
          help="URL used to set up distributed training",
      )
  
      parser.add_argument(
          "--dataset-root",
          help="Root folder where the datasets are stored. Will be passed as the 'root' parameter of the datasets.",
          required=True,
      )
  
      parser.add_argument(
          "--weights",
          default=None,
          type=str,
          help="the weights enum name to load.",
      )
      parser.add_argument(
          "--device",
          default="cuda",
          type=str,
          help="device (Use cuda or cpu, Default: cuda)",
      )
      parser.add_argument(
          "--use-deterministic-algorithms",
          action="store_true",
          help="Forces the use of deterministic algorithms only.",
      )
  
      return parser
  
file_path: vision/references/optical_flow/train.py
imports: import argparse
  import warnings
  from math import ceil
  from pathlib import Path
  import torch
  import torchvision.models.optical_flow
  import utils
  from presets import OpticalFlowPresetEval, OpticalFlowPresetTrain
  from torchvision.datasets import FlyingChairs, FlyingThings3D, HD1K, KittiFlow, Sintel
label_desc: Use image node_id 6 for calling a global function with example usage: get_args_parser(add_help) and returns: parser