class_docstr: ernie model 
class_docstr_tok: ["ernie","model"]
docstr: Fundamental pretrained Ernie model
docstr_tok: ["Fundamental","pretrained","Ernie","model"]
code: def __init__(self, cfg, name=""):
      """
      Fundamental pretrained Ernie model
      """
      nn.Layer.__init__(self)
      self.cfg = cfg
      d_model = cfg["hidden_size"]
      d_emb = cfg.get("emb_size", cfg["hidden_size"])
      d_vocab = cfg["vocab_size"]
      d_pos = cfg["max_position_embeddings"]
      # d_sent = cfg.get("sent_type_vocab_size", 4) or cfg.get('type_vocab_size', 4)
      if cfg.get("sent_type_vocab_size"):
          d_sent = cfg["sent_type_vocab_size"]
      else:
          d_sent = cfg.get("type_vocab_size", 2)
      self.n_head = cfg["num_attention_heads"]
      self.return_additional_info = cfg.get(
          "return_additional_info", False
      )
      self.initializer = nn.initializer.TruncatedNormal(
          std=cfg["initializer_range"]
      )
  
      self.ln = _build_ln(
          d_model, name=append_name(name, "pre_encoder")
      )
      self.word_emb = nn.Embedding(
          d_vocab,
          d_emb,
          weight_attr=paddle.ParamAttr(
              name=append_name(name, "word_embedding"),
              initializer=self.initializer,
          ),
      )
      self.pos_emb = nn.Embedding(
          d_pos,
          d_emb,
          weight_attr=paddle.ParamAttr(
              name=append_name(name, "pos_embedding"),
              initializer=self.initializer,
          ),
      )
      # self.sent_emb = nn.Embedding(
      #    d_sent,
      #    d_emb,
      #    weight_attr=paddle.ParamAttr(name=append_name(name, 'sent_embedding'), initializer=self.initializer))
      self._use_sent_id = cfg.get("use_sent_id", True)
      self._use_sent_id = False
      if self._use_sent_id:
          self.sent_emb = nn.Embedding(
              d_sent,
              d_emb,
              weight_attr=paddle.ParamAttr(
                  name=append_name(name, "sent_embedding"),
                  initializer=self.initializer,
              ),
          )
      self._use_task_id = cfg.get("use_task_id", False)
      self._use_task_id = False
      if self._use_task_id:
          self._task_types = cfg.get("task_type_vocab_size", 3)
          logging.info(
              "using task_id, #task_types:{}".format(self._task_types)
          )
          self.task_emb = nn.Embedding(
              self._task_types,
              d_emb,
              weight_attr=paddle.ParamAttr(
                  name=append_name(name, "task_embedding"),
                  initializer=self.initializer,
              ),
          )
  
      prob = cfg["hidden_dropout_prob"]
      self.dropout = nn.Dropout(p=prob)
  
      self.encoder_stack = ErnieEncoderStack(
          cfg, append_name(name, "encoder")
      )
  
      if cfg.get("has_pooler", True):
          self.pooler = _build_linear(
              cfg["hidden_size"],
              cfg["hidden_size"],
              append_name(name, "pooled_fc"),
              self.initializer,
          )
      else:
          self.pooler = None
  
      self.key_tag = None
      self._checkpoints = []
      self.train()
  
imports: import logging
  import re
  import time
  import paddle
  from paddle import nn
  from paddle.nn import functional
label_desc: Use image node_id 1 to create a new ErnieModel object from inherited base classes: nn with example: obj = ErnieModel(cfg, name)