code: def __init__(self, args):
      self.model_file = os.path.abspath(args.model_file)
      if not os.path.isfile(self.model_file):
          raise Exception(
              f"there is no such model file {self.model_file}"
          )
  
      self.model_repo = os.path.dirname(self.model_file)
      self.generation_method = args.generation_method
      self.beam_size = args.beam_size
      self.topk = args.topk
      self.topp = args.topp
      self.eos_id = None
      self.bos_id = None
      self.config_path = os.path.join(self.model_repo, "config.json")
  
      if not os.path.isfile(self.config_path):
          raise Exception(
              f"there is no such config file {self.config_path}"
          )
  
      config_file = open(self.config_path)
      config = json.load(config_file)
      config_file.close()
  
      self.padding_id = config.get("pad_token_id")
      self.max_step = config.get("max_sequence_length")
      self.hidden_size = config.get("hidden_size")
      self.inner_size = config.get("intermediate_size")
      self.head_num = config.get("num_attention_heads")
      self.vocab_size = config.get("vocab_size")
      self.layer_num = config.get("num_hidden_layers")
      self.extra_decode_length = (
          self.max_step
          if args.extra_decode_length is None
          else args.extra_decode_length
      )
  
file_path: lightseq/lightseq/csrc/export/util.py
imports: import argparse
  from re import L
  import os
  import h5py
  import json
  import numpy
label_desc: Use image node_id 1 to create a new ModelArguements object from inherited base classes: object with example: obj = ModelArguements(args)