code: def parse_args(extra_args_provider=None, ignore_unknown_args=False):
      """Parse all arguments."""
      parser = argparse.ArgumentParser(
          description="Megatron-LM Arguments", allow_abbrev=False
      )
  
      # Standard arguments.
      parser = _add_network_size_args(parser)
      parser = _add_regularization_args(parser)
      parser = _add_training_args(parser)
      parser = _add_initialization_args(parser)
      parser = _add_learning_rate_args(parser)
      parser = _add_checkpointing_args(parser)
      parser = _add_mixed_precision_args(parser)
      parser = _add_distributed_args(parser)
      parser = _add_validation_args(parser)
      parser = _add_data_args(parser)
      parser = _add_autoresume_args(parser)
      parser = _add_biencoder_args(parser)
      parser = _add_vision_args(parser)
      parser = _add_logging_args(parser)
      parser = _add_inference_args(parser)
      parser = _add_transformer_engine_args(parser)
      parser = _add_retro_args(parser)
      parser = _add_experimental_args(parser)
  
      # Custom arguments.
      if extra_args_provider is not None:
          parser = extra_args_provider(parser)
  
      # Parse.
      if ignore_unknown_args:
          args, _ = parser.parse_known_args()
      else:
          args = parser.parse_args()
  
      # Args from environment
      args.rank = int(os.getenv("RANK", "0"))
      args.world_size = int(os.getenv("WORLD_SIZE", "1"))
  
      return args
  
imports: import argparse
  import dataclasses
  import json
  import os
  import torch
  import types
  import torch.nn.functional
  from megatron.global_vars import set_retro_args, get_retro_args
  from tools.retro.utils import get_args_path
  from megatron.core.models.retro import RetroConfig
  from megatron.core.transformer import TransformerConfig
label_desc: Use image node_id 1 for calling a global function with example usage: parse_args(extra_args_provider, ignore_unknown_args) and returns: args