code: def transform_gpt2_to_texar_config(input_json_path):
      """
      Remap the config file
      """
      config_gpt = json.loads(open(input_json_path).read())
      configs = dict()
      configs["vocab_size"] = config_gpt["n_vocab"]
      configs["context_size"] = config_gpt["n_ctx"]
      configs["embedding_size"] = config_gpt["n_embd"]
      hidden_dim = config_gpt["n_embd"]
      configs["embed"] = {
          "dim": hidden_dim,
      }
      configs["position_size"] = config_gpt["n_ctx"]
      configs["pos_embed"] = {"dim": hidden_dim}
      configs["decoder"] = {
          "dim": hidden_dim,
          "num_blocks": config_gpt["n_layer"],
          "multihead_attention": {
              "use_bias": True,
              "num_units": hidden_dim,
              "num_heads": config_gpt["n_head"],
              "output_dim": hidden_dim,
          },
          "initializer": {
              "type": "variance_scaling_initializer",
              "kwargs": {
                  "scale": 1.0,
                  "mode": "fan_avg",
                  "distribution": "uniform",
              },
          },
          "poswise_feedforward": {
              "layers": [
                  {
                      "type": "Dense",
                      "kwargs": {
                          "name": "conv1",
                          "units": hidden_dim * 4,
                          "activation": "gelu",
                          "use_bias": True,
                      },
                  },
                  {
                      "type": "Dense",
                      "kwargs": {
                          "name": "conv2",
                          "units": hidden_dim,
                          "use_bias": True,
                      },
                  },
              ],
              "name": "ffn",
          },
      }
      return HParams(configs, default_hparams=None)
  
file_path: texar/examples/gpt-2/utils/model_utils.py
imports: import sys
  import json
  import tensorflow
  import numpy
  from texar.tf import HParams
label_desc: Use image node_id 1 for calling a global function with example usage: transform_gpt2_to_texar_config(input_json_path) and returns: HParams