class_docstr: Transformer decoder consisting of *config.num_hidden_layers* layers.
  Each layer is a [`DecoderLayer`]
  
  Args:
      config: BaiChuanConfig
class_docstr_tok: ["Transformer","decoder","consisting","of","*","config.num_hidden_layers","*","layers",".","Each","layer","is","a","[","`","DecoderLayer","`","]","Args",":","config",":","BaiChuanConfig"]
code: def __init__(self, config: BaiChuanConfig):
      super().__init__(config)
      self.padding_idx = config.pad_token_id
      self.vocab_size = config.vocab_size
  
      self.embed_tokens = nn.Embedding(
          config.vocab_size, config.hidden_size, self.padding_idx
      )
      self.layers = nn.ModuleList(
          [
              DecoderLayer(config)
              for _ in range(config.num_hidden_layers)
          ]
      )
      self.norm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
  
      self.gradient_checkpointing = False
      # Initialize weights and apply final processing
      self.post_init()
  
imports: from .configuration_baichuan import BaiChuanConfig
  from transformers import PreTrainedModel, add_start_docstrings
  from transformers.activations import ACT2FN
  from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutputWithPast
  from transformers.utils import logging, add_start_docstrings_to_model_forward, replace_return_docstrings
  import math
  from typing import List, Optional, Tuple, Union
  import torch
  import torch.utils.checkpoint
  from torch import nn
  from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
label_desc: Use image node_id 1 to create a new Model object from inherited base classes: PreTrainedModel with example: obj = Model(config)