class_docstr: GPT Model
class_docstr_tok: ["GPT","Model"]
code: def __init__(
      self,
      hidden_size=768,
      num_layers=12,
      num_attention_heads=12,
      max_seq_len=1024,
      vocab_size=50257,
      checkpoint=False,
  ):
      super().__init__()
      self.checkpoint = checkpoint
      self.model = GPT2LMHeadModel(
          GPT2Config(
              n_embd=hidden_size,
              n_layer=num_layers,
              n_head=num_attention_heads,
              n_positions=max_seq_len,
              n_ctx=max_seq_len,
              vocab_size=vocab_size,
          )
      )
      if checkpoint:
          self.model.gradient_checkpointing_enable()
  
imports: import time
  from copy import deepcopy
  from typing import Callable, Tuple
  import numpy
  import torch
  import torch.nn
  from transformers import GPT2Config, GPT2LMHeadModel
  from colossalai.auto_parallel.checkpoint import CheckpointSolverRotor
  from colossalai.fx import metainfo_trace
label_desc: Use image node_id 1 to create a new GPTLMModel object from inherited base classes: nn with example: obj = GPTLMModel(hidden_size, num_layers, num_attention_heads, max_seq_len, vocab_size, checkpoint)