class_docstr: Transformer model for text sequence to sequence
class_docstr_tok: ["Transformer","model","for","text","sequence","to","sequence"]
code: def __init__(self, config, **kwargs):
      super().__init__(config, **kwargs)
      tf.logging.info("Initialize TransformerModel...")
      model_config = config["model"]["net"]["structure"]
      self.is_infer = config["model"]["is_infer"]
      self.dropout_rate = model_config["dropout_rate"]
      self.num_layers = model_config["num_layers"]
      self.max_enc_len = model_config["max_enc_len"]
      self.max_dec_len = model_config["max_dec_len"]
      self.share_embedding = model_config.get("share_embedding", True)
      self.use_const = model_config.get("use_const", True)
  
      self.embed_d = tf.keras.layers.Dropout(self.dropout_rate)
      self.pos_embed = layers.PositionEmbedding(
          self.max_enc_len,
          self.embedding_size,
          self.use_const,
          "enc_pos",
      )
  
      self.encoder = layers.TransformerEncoder(config)
      self.decoder = layers.TransformerDecoder(
          config, (self.embed, self.pos_embed), self.decode_vocab_size
      )
      logging.info(
          "decode_vocab_size: {}".format(self.decode_vocab_size)
      )
      logging.info("Initialize TransformerModel done.")
  
file_path: delta/delta/models/text_seq2seq_model.py
imports: import pickle
  import delta.compat
  from absl import logging
  from delta import layers
  from delta import utils
  from delta.models.base_model import Model
  from delta.utils import registers
  from delta.layers.utils import compute_sen_lens
  from delta.layers.utils_tf import create_padding_mask
label_desc: Use image node_id 1 to create a new TransformerSeq2SeqModel object from inherited base classes: Seq2SeqModel with example: obj = TransformerSeq2SeqModel(config)