class_docstr: TransformerEmbedding is based on bert4keras.
  The embeddings itself are wrapped into our simple embedding interface so that they can be used like any other embedding.
class_docstr_tok: ["TransformerEmbedding","is","based","on","bert4keras",".","The","embeddings","itself","are","wrapped","into","our","simple","embedding","interface","so","that","they","can","be","used","like","any","other","embedding","."]
code: def build_embedding_model(
      self,
      *,
      vocab_size: int = None,
      force: bool = False,
      **kwargs: Dict,
  ) -> None:
      if self.embed_model is None:
          config_path = self.config_path
          with open(config_path, "r") as f:
              config = json.loads(f.read())
          if "max_position" in config:
              self.max_position = config["max_position"]
          else:
              self.max_position = config.get("max_position_embeddings")
  
          bert_model = build_transformer_model(
              config_path=self.config_path,
              checkpoint_path=self.checkpoint_path,
              model=self.model_type,
              application="encoder",
              return_keras_model=True,
          )
          for layer in bert_model.layers:
              layer.trainable = False
          self.embed_model = bert_model
          self.embedding_size = bert_model.output.shape[-1]
  
file_path: Kashgari/kashgari/embeddings/transformer_embedding.py
imports: import codecs
  import json
  from typing import Dict, List, Any, Optional
  from bert4keras.models import build_transformer_model
  from kashgari.embeddings.abc_embedding import ABCEmbedding
  from kashgari.logger import logger
label_desc: Use image node_id 4 for calling the TransformerEmbedding obj's underlying member method code with example usage: obj.build_embedding_model() without return types