code: def __init__(self, config: GPT2Config):
      super().__init__()
      self.pad_vocab_size_multiple_8 = getattr(
          config, "pad_vocab_size_multiple_8", False
      )
      if self.pad_vocab_size_multiple_8:
          if config.vocab_size % 8 != 0:
              config.vocab_size += 8 - (config.vocab_size % 8)
  
      self.embeddings = GPT2Embeddings(
          config.hidden_size,
          config.vocab_size,
          config.max_position_embeddings,
      )
      self.emb_drop = nn.Dropout(config.embd_pdrop)
  
      # We change the order of residual and layer norm:
      # Instead of LN -> Attn / MLP -> Dropout -> Add, we do:
      # Attn / MLP -> Dropout -> Add -> LN, returning both the residual branch (output of Add) and
      # the main branch (output of LN). The model definition is unchanged, but the mapping of the
      # nn.LayerNorm weights are changed.
      # This is for performance reason: we can fuse dropout + add + layer_norm.
      self.fused_dropout_add_ln = getattr(
          config, "fused_dropout_add_ln", False
      )
      if self.fused_dropout_add_ln and dropout_add_layer_norm is None:
          raise ImportError("dropout_add_layer_norm is not installed")
      # self.ln_0 is the first layer norm in the model, while self.ln_f (in the pretrained weight)
      # is the final layer norm.
      self.ln_0 = nn.LayerNorm(
          config.hidden_size, eps=config.layer_norm_epsilon
      )
  
      self.layers = nn.ModuleList(
          [
              create_block(config, layer_idx=i)
              for i in range(config.num_hidden_layers)
          ]
      )
  
      self.apply(
          partial(
              _init_weights,
              n_layer=config.num_hidden_layers,
              initializer_range=config.initializer_range,
          )
      )
  
imports: import math
  from functools import partial
  from collections import namedtuple
  from collections.abc import Sequence
  import torch
  import torch.nn
  import torch.nn.functional
  from transformers.models.gpt2.configuration_gpt2 import GPT2Config
  from src.models.modules.mha import MHA
  from src.models.modules.mlp import Mlp, FusedDenseGeluDense
  from src.models.modules.block import Block
  from src.models.modules.embedding import GPT2Embeddings
label_desc: Use image node_id 1 to create a new GPT2Model object from inherited base classes: nn with example: obj = GPT2Model(config)