code: def core_transformer_config_from_args(args):
      # Translate args to core transformer configuration
      kw_args = {}
      for f in dataclasses.fields(TransformerConfig):
          if hasattr(args, f.name):
              kw_args[f.name] = getattr(args, f.name)
      kw_args["persist_layer_norm"] = not args.no_persist_layer_norm
      kw_args["layernorm_zero_centered_gamma"] = args.apply_layernorm_1p
      kw_args["layernorm_epsilon"] = args.norm_epsilon
      kw_args["deallocate_pipeline_outputs"] = True
      kw_args["pipeline_dtype"] = args.params_dtype
      kw_args["batch_p2p_comm"] = not args.overlap_p2p_comm
      kw_args["num_moe_experts"] = args.num_experts
      if args.swiglu:
          kw_args["activation_func"] = F.silu
          kw_args["gated_linear_unit"] = True
          kw_args["bias_gelu_fusion"] = False
      if args.squared_relu:
          assert not args.swiglu
  
          def squared_relu(x):
              return torch.pow(F.relu(x), 2)
  
          kw_args["activation_func"] = squared_relu
      if args.init_method_xavier_uniform:
          kw_args["init_method"] = torch.nn.init.xavier_uniform_
          kw_args["scaled_init_method"] = torch.nn.init.xavier_uniform_
      if args.group_query_attention:
          kw_args["num_query_groups"] = args.num_query_groups
      else:
          kw_args["num_query_groups"] = None
  
      # If using Retro, return Retro config.
      retro_args = get_retro_args()
      if retro_args:
          kw_args["retro_preprocess"] = retro_args
          return RetroConfig(**kw_args)
  
      # Return Transformer config.
      return TransformerConfig(**kw_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 5 for calling a global function with example usage: core_transformer_config_from_args(args) and returns: TransformerConfig, RetroConfig, torch