code: def parse_args():
      parser = argparse.ArgumentParser(
          formatter_class=argparse.ArgumentDefaultsHelpFormatter,
          description=__doc__,
      )
      # Input / output
      group = parser.add_argument_group("Input / output")
      group.add_argument("--input-files", type=pathlib.Path, nargs="+")
      group.add_argument(
          "--mmap-folder",
          type=pathlib.Path,
          default="/dev/shm/gluonnlp",
          help="Folder to place mmap files for sharing dataset accross local worker processes.",
      )
      group.add_argument("--lang", type=str, choices=["python"])
      group.add_argument(
          "--ckpt_dir",
          type=str,
          default="./ckpt_dir",
          help="Path to checkpoint directory",
      )
      group.add_argument(
          "--log_interval", type=int, default=50, help="Report interval"
      )
      group.add_argument(
          "--ckpt_interval",
          type=int,
          default=25000,
          help="Checkpoint interval",
      )
      group.add_argument(
          "--verbose", action="store_true", help="verbose logging"
      )
  
      # model
      group = parser.add_argument_group("Model")
      group.add_argument(
          "--model_name",
          type=str,
          default="coder_base",
          choices=nlp.models.bert.list_pretrained_bert(),
          help="Name of the model configuration.",
      )
  
      # training
      group = parser.add_argument_group("Training")
      group.add_argument(
          "--seed", type=int, default=100, help="Random seed"
      )
      group.add_argument(
          "--batch_size",
          type=int,
          default=8,
          help="Batch size per GPU in a minibatch.",
      )
      group.add_argument(
          "--num_accumulated",
          type=int,
          default=1,
          help="Number of batches for gradient accumulation. "
          "total_batch_size = batch_size_per_worker * num_worker * accumulate.",
      )
      group.add_argument(
          "--num_steps",
          type=int,
          default=20,
          help="Number of optimization steps",
      )
      group.add_argument(
          "--start_step",
          type=int,
          default=0,
          help="Start optimization step from the checkpoint.",
      )
      group.add_argument(
          "--lr", type=float, default=0.005, help="Learning rate"
      )
      group.add_argument(
          "--weight_decay",
          type=float,
          default=0.01,
          help="weight decay",
      )
      group.add_argument(
          "--max_grad_norm",
          type=float,
          default=1.0,
          help="Max gradient norm.",
      )
      group.add_argument(
          "--warmup_ratio",
          type=float,
          default=0.05,
          help="Ratio of warmup steps in the learning rate scheduler.",
      )
      group.add_argument(
          "--const_ratio",
          type=float,
          default=0.25,
          help="Ratio of constant steps in the learning rate scheduler.",
      )
  
      group.add_argument(
          "--num_dataloader_workers",
          type=int,
          default=4,
          help="Number of workers to pre-process dataset.",
      )
  
      # phase 2
      parser.add_argument(
          "--phase2", action="store_true", help="phase 2 training"
      )
      parser.add_argument(
          "--phase1_num_steps",
          type=int,
          help="number of steps for phase 1",
      )
  
      # computation and communication
      group = parser.add_argument_group("Computation and communication")
      group.add_argument(
          "--local_rank",
          type=int,
          default=-1,
          help="Rank in distributed training",
      )
      group.add_argument(
          "--fp16",
          action=nlp.utils.misc.BooleanOptionalAction,
          default=True,
          help="Whether to use 16-bit (mixed) precision instead of 32-bit.",
      )
      parser.add_argument(
          "--ZeRO",
          action=nlp.utils.misc.BooleanOptionalAction,
          default=False,
          help="Use ZeRO parameter and optimizer state sharding. "
          "Helps speed-up and reduce memory usage of large models.",
      )
      group.add_argument(
          "--cuda",
          action=nlp.utils.misc.BooleanOptionalAction,
          default=True,
          help="Use Cuda if available.",
      )
      group.add_argument(
          "--activation-checkpointing",
          action=nlp.utils.misc.BooleanOptionalAction,
          default=False,
          help="Trade compute for memory by checkpointing activations.",
      )
      args = parser.parse_args()
  
      # Yet to be supported settings
      assert not args.activation_checkpointing  # TODO
  
      return args
  
imports: import argparse
  import functools
  import json
  import logging
  import os
  import pathlib
  import random
  import shutil
  import time
  import warnings
  from contextlib import suppress
  import gluonnlp
  import numpy
  import pyarrow
  import pyarrow.compute
  import pyarrow.dataset
  import torch
  from fairscale.nn.data_parallel import ShardedDataParallel
  from fairscale.optim.grad_scaler import ShardedGradScaler
  from fairscale.optim.oss import OSS
  from torch import distributed
  from torch.nn.parallel import DistributedDataParallel
  from torch.utils.data import DataLoader, RandomSampler
  from torch.utils.data.distributed import DistributedSampler
  from torch.utils.tensorboard import SummaryWriter
label_desc: Use image node_id 2 for calling a global function with example usage: parse_args() and returns: args