code: def parse_args():
      import argparse
  
      parser = argparse.ArgumentParser(
          description="DocTR training script for object detection (PyTorch)",
          formatter_class=argparse.ArgumentDefaultsHelpFormatter,
      )
      parser.add_argument(
          "arch", type=str, help="text-detection model to train"
      )
      parser.add_argument(
          "--name",
          type=str,
          default=None,
          help="Name of your training experiment",
      )
      parser.add_argument(
          "--epochs",
          type=int,
          default=20,
          help="number of epochs to train the model on",
      )
      parser.add_argument(
          "-b",
          "--batch_size",
          type=int,
          default=2,
          help="batch size for training",
      )
      parser.add_argument(
          "--device", default=None, type=int, help="device"
      )
      parser.add_argument(
          "--input_size",
          type=int,
          default=1024,
          help="model input size, H = W",
      )
      parser.add_argument(
          "--lr",
          type=float,
          default=0.001,
          help="learning rate for the optimizer (SGD)",
      )
      parser.add_argument(
          "--wd",
          "--weight-decay",
          default=0,
          type=float,
          help="weight decay",
          dest="weight_decay",
      )
      parser.add_argument(
          "-j",
          "--workers",
          type=int,
          default=None,
          help="number of workers used for dataloading",
      )
      parser.add_argument(
          "--resume",
          type=str,
          default=None,
          help="Path to your checkpoint",
      )
      parser.add_argument(
          "--test-only",
          dest="test_only",
          action="store_true",
          help="Run the validation loop",
      )
      parser.add_argument(
          "--show-samples",
          dest="show_samples",
          action="store_true",
          help="Display unormalized training samples",
      )
      parser.add_argument(
          "--freeze-backbone",
          dest="freeze_backbone",
          action="store_true",
          help="freeze model backbone for fine-tuning",
      )
      parser.add_argument(
          "--wb",
          dest="wb",
          action="store_true",
          help="Log to Weights & Biases",
      )
      parser.add_argument(
          "--push-to-hub",
          dest="push_to_hub",
          action="store_true",
          help="Push to Huggingface Hub",
      )
      parser.add_argument(
          "--pretrained",
          dest="pretrained",
          action="store_true",
          help="Load pretrained parameters before starting the training",
      )
      parser.add_argument(
          "--amp",
          dest="amp",
          help="Use Automatic Mixed Precision",
          action="store_true",
      )
      parser.add_argument(
          "--find-lr",
          action="store_true",
          help="Gridsearch the optimal LR",
      )
      parser.add_argument(
          "--early-stop",
          action="store_true",
          help="Enable early stopping",
      )
      parser.add_argument(
          "--early-stop-epochs",
          type=int,
          default=5,
          help="Patience for early stopping",
      )
      args = parser.parse_args()
      return args
  
imports: import os
  import datetime
  import logging
  import multiprocessing
  import time
  import numpy
  import torch
  import torch.optim
  import wandb
  from torch.optim.lr_scheduler import MultiplicativeLR, StepLR
  from torch.utils.data import DataLoader, RandomSampler, SequentialSampler
  from torchvision.transforms import ColorJitter, Compose, GaussianBlur
  from tqdm.auto import tqdm
  from doctr import transforms
  from doctr.datasets import DocArtefacts
  from doctr.models import login_to_hub, obj_detection, push_to_hf_hub
  from doctr.utils import DetectionMetric
  from utils import EarlyStopper, plot_recorder, plot_samples
label_desc: Use image node_id 6 for calling a global function with example usage: parse_args() and returns: args