class_docstr: GPT Transformer Model
class_docstr_tok: ["GPT","Transformer","Model"]
code: def __init__(self, config: GPTConfig):
      super().__init__()
      assert config.block_size is not None
      self.block_size = config.block_size
  
      self.transformer = nn.ModuleDict(
          dict(
              drop=nn.Dropout(config.embed_pdrop),
              h=nn.ModuleList(
                  [Block(config) for _ in range(config.n_layer)]
              ),
              ln_f=nn.LayerNorm(config.n_embed),
          )
      )
  
      # 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"):
              torch.nn.init.normal_(
                  p, mean=0.0, std=0.02 / math.sqrt(2 * config.n_layer)
              )
  
imports: import math
  from dataclasses import dataclass
  from typing import Tuple
  import torch
  import torch.nn
  from torch.nn import functional
  from ray.rllib.utils.annotations import DeveloperAPI
  from ray.rllib.utils.deprecation import Deprecated
label_desc: Use image node_id 1 to create a new GPT object from inherited base classes: nn with example: obj = GPT(config)