code: def __init__(self, model_config_path):
      with open(model_config_path) as f:
          read_config = json.load(f)
  
      # Loaded/automatic settings
  
      self.bos_token_id = (
          read_config["bos_token_id"]
          if "bos_token_id" in read_config
          else 1
      )
      self.eos_token_id = (
          read_config["eos_token_id"]
          if "eos_token_id" in read_config
          else 2
      )
      self.pad_token_id = (
          read_config["pad_token_id"]
          if "pad_token_id" in read_config
          else 0
      )
  
      self.hidden_size = read_config["hidden_size"]
      self.initializer_range = read_config["initializer_range"]
      self.intermediate_size = read_config["intermediate_size"]
      self.num_attention_heads = read_config["num_attention_heads"]
      self.num_hidden_layers = read_config["num_hidden_layers"]
      self.rms_norm_eps = read_config["rms_norm_eps"]
      self.vocab_size = read_config["vocab_size"]
  
      if "num_key_value_heads" in read_config:
          self.num_key_value_heads = read_config["num_key_value_heads"]
          self.num_key_value_groups = (
              self.num_attention_heads // self.num_key_value_heads
          )
      else:
          self.num_key_value_heads = self.num_attention_heads
          self.num_key_value_groups = 1
  
      self.rotary_embedding_base = (
          read_config["rope_theta"]
          if "rope_theta" in read_config
          else 10000.0
      )
      self.head_dim = self.hidden_size // self.num_attention_heads
  
      self.groupsize = None  # Autodetected
      self.act_order = False  # Autodetected
      self.empty_g_idx = False  # Autodetected
  
      # Required settings
  
      self.model_path = None  # str or list[str]
      self.device_map = ExLlamaDeviceMap(self.num_hidden_layers)
  
      # Optional settings
  
      self.max_seq_len = 2048  # Reduce to save memory. Can also be increased, ideally while also using compress_pos_emn and a compatible model/LoRA
      self.max_input_len = 2048  # Maximum length of input IDs in a single forward pass. Sequences longer than this will be processed in multiple steps
      self.max_attention_size = (
          2048**2
      )  # Sequences will be processed in chunks to keep the size of the attention weights matrix <= this
      self.compress_pos_emb = 1.0  # Increase to compress positional embeddings applied to sequence
      self.alpha_value = 1.0  # Alpha value for NTK RoPE scaling. Similar to compress_pos_emb, higher values increaste ctx but add Perplexity.
      self.gpu_peer_fix = False  # Apparently Torch can have problems transferring tensors directly one GPU to another sometimes. Enable this to expliticly move tensors via system RAM instead, where needed
      self.auto_map = None  # List of floats with memory allocation in GB, per CUDA device, overrides device_map
  
      # Tuning
  
      self.use_flash_attn_2 = False
      self.matmul_recons_thd = 8
      self.fused_mlp_thd = 2
      self.sdp_thd = 8
      self.fused_attn = True
      self.matmul_fused_remap = False
      self.rmsnorm_no_half2 = False
      self.rope_no_half2 = False
      self.matmul_no_half2 = False
      self.silu_no_half2 = False
      self.concurrent_streams = False
  
imports: import sys
  import torch
  from torch import nn
  import torch.nn.functional
  from safetensors import safe_open
  import cuda_ext
  import json
  import math
  import gc
  from enum import Enum
label_desc: Use image node_id 1 to create a new ExLlamaConfig object  with example: obj = ExLlamaConfig(model_config_path)