docstr: Fundamental pretrained Ernie model
docstr_tok: ["Fundamental","pretrained","Ernie","model"]
code: def __init__(self, cfg, name=None):
      """
      Fundamental pretrained Ernie model
      """
      log.debug("init ErnieModel with config: %s" % repr(cfg))
      D.Layer.__init__(self)
      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") or cfg["type_vocab_size"]
      self.n_head = cfg["num_attention_heads"]
      self.return_additional_info = cfg.get(
          "return_additional_info", False
      )
      initializer = F.initializer.TruncatedNormal(
          scale=cfg["initializer_range"]
      )
  
      self.ln = _build_ln(
          d_model, name=append_name(name, "pre_encoder")
      )
      self.word_emb = D.Embedding(
          [d_vocab, d_emb],
          param_attr=F.ParamAttr(
              name=append_name(name, "word_embedding"),
              initializer=initializer,
          ),
      )
      self.pos_emb = D.Embedding(
          [d_pos, d_emb],
          param_attr=F.ParamAttr(
              name=append_name(name, "pos_embedding"),
              initializer=initializer,
          ),
      )
      self.sent_emb = D.Embedding(
          [d_sent, d_emb],
          param_attr=F.ParamAttr(
              name=append_name(name, "sent_embedding"),
              initializer=initializer,
          ),
      )
      prob = cfg["hidden_dropout_prob"]
      self.dropout = (
          lambda i: L.dropout(
              i,
              dropout_prob=prob,
              dropout_implementation="upscale_in_train",
          )
          if self.training
          else i
      )
  
      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"),
              initializer,
              act="tanh",
          )
      else:
          self.pooler = None
      self.train()
  
imports: from __future__ import division
  from __future__ import absolute_import
  from __future__ import print_function
  from __future__ import unicode_literals
  import logging
  import paddle.fluid.dygraph
  import paddle.fluid
  import paddle.fluid.layers
label_desc: Use image node_id 1 to create a new ErnieModel object from inherited base class: D with example: obj = ErnieModel(cfg, name)