code: def parse_args():
      import argparse
  
      parser = argparse.ArgumentParser(
          description="DocTR training script for character classification (PyTorch)",
          formatter_class=argparse.ArgumentDefaultsHelpFormatter,
      )
  
      parser.add_argument(
          "arch", type=str, help="text-recognition model to train"
      )
      parser.add_argument(
          "--name",
          type=str,
          default=None,
          help="Name of your training experiment",
      )
      parser.add_argument(
          "--epochs",
          type=int,
          default=10,
          help="number of epochs to train the model on",
      )
      parser.add_argument(
          "-b",
          "--batch_size",
          type=int,
          default=64,
          help="batch size for training",
      )
      parser.add_argument(
          "--device", default=None, type=int, help="device"
      )
      parser.add_argument(
          "--input_size",
          type=int,
          default=32,
          help="input size H for the model, W = H",
      )
      parser.add_argument(
          "--lr",
          type=float,
          default=0.001,
          help="learning rate for the optimizer (Adam)",
      )
      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(
          "--font",
          type=str,
          default="FreeMono.ttf,FreeSans.ttf,FreeSerif.ttf",
          help="Font family to be used",
      )
      parser.add_argument(
          "--vocab",
          type=str,
          default="french",
          help="Vocab to be used for training",
      )
      parser.add_argument(
          "--train-samples",
          dest="train_samples",
          type=int,
          default=1000,
          help="Multiplied by the vocab length gets you the number of training samples that will be used.",
      )
      parser.add_argument(
          "--val-samples",
          dest="val_samples",
          type=int,
          default=20,
          help="Multiplied by the vocab length gets you the number of validation samples that will be used.",
      )
      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(
          "--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(
          "--export-onnx",
          dest="export_onnx",
          action="store_true",
          help="Export the model to ONNX",
      )
      parser.add_argument(
          "--sched", type=str, default="cosine", help="scheduler to use"
      )
      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",
      )
      parser.add_argument(
          "--early-stop-delta",
          type=float,
          default=0.01,
          help="Minimum Delta 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 wandb
  from torch.nn.functional import cross_entropy
  from torch.optim.lr_scheduler import CosineAnnealingLR, MultiplicativeLR, OneCycleLR
  from torch.utils.data import DataLoader, RandomSampler, SequentialSampler
  from torchvision.transforms.v2 import Compose, GaussianBlur, InterpolationMode, Normalize, RandomGrayscale, RandomPerspective, RandomPhotometricDistort, RandomRotation
  from tqdm.auto import tqdm
  from doctr import transforms
  from doctr.datasets import VOCABS, CharacterGenerator
  from doctr.models import classification, login_to_hub, push_to_hf_hub
  from doctr.models.utils import export_model_to_onnx
  from utils import EarlyStopper, plot_recorder, plot_samples
label_desc: Use image node_id 5 for calling a global function with example usage: parse_args() and returns: args