class_docstr: GPT Language Model
code: def __init__(self, config: GPTConfig) -> None:
      super().__init__()
      self.block_size: int = config.block_size
      config = self._set_model_config(config)
  
      # input embedding stem
      self.emb_stem = EmbeddingStem(config)
      # transformer
      self.blocks = nn.Sequential(
          *[Block(config) for _ in range(config.n_layer)]
      )
      # decoder head
      self.ln_f = nn.LayerNorm(config.n_embd)
      self.head = nn.Linear(
          config.n_embd, config.vocab_size, bias=False
      )
  
      # init all weights, and apply a special scaled init to the residual projections, per GPT-2 paper
      self.apply(self._init_weights)
      for pn, p in self.named_parameters():
          if pn.endswith("c_proj.weight"):
              p.data.normal_(
                  mean=0.0, std=0.02 / math.sqrt(2 * config.n_layer)
              )
  
      # report number of parameters (note we don't count the decoder parameters in lm_head)
      n_params = sum(p.numel() for p in self.blocks.parameters())
      print("number of parameters: %.2fM" % (n_params / 1e6,))
  
imports: import math
  from dataclasses import dataclass
  from typing import Optional, Tuple
  import torch
  import torch.nn
  from torch.nn import functional
label_desc: Use image node_id 1 to create a new GPT object from inherited base classes: nn with example: obj = GPT(config)