class_docstr: Base class for text sequence to sequence models
class_docstr_tok: ["Base","class","for","text","sequence","to","sequence","models"]
code: def __init__(self, config, **kwargs):
      super().__init__(**kwargs)
      logging.info("Initialize S2SModel")
      data_config = config["data"]
      model_config = config["model"]["net"]["structure"]
      self.use_label_vocab = data_config["task"]["use_label_vocab"]
      self.label_vocab_size = data_config["label_vocab_size"]
      self.vocab_size = config["data"]["vocab_size"]
      self.use_pretrained_embedding = config["model"][
          "use_pre_train_emb"
      ]
      self.embedding_size = model_config["embedding_size"]
      if self.use_pretrained_embedding:
          self.embedding_path = config["model"]["embedding_path"]
          logging.info(
              "Loading embedding file from: {}".format(
                  self.embedding_path
              )
          )
          self._word_embedding_init = pickle.load(
              open(self.embedding_path, "rb")
          )
          self.embed_initializer = tf.constant_initializer(
              self._word_embedding_init
          )
      else:
          self.embed_initializer = tf.random_uniform_initializer(
              -0.1, 0.1
          )
  
      self.embed = tf.keras.layers.Embedding(
          self.vocab_size,
          self.embedding_size,
          embeddings_initializer=self.embed_initializer,
      )
      self.share_embedding = model_config["share_embedding"]
      if self.use_label_vocab:
          self.decode_vocab_size = self.label_vocab_size
      else:
          self.decode_vocab_size = self.vocab_size
      if self.share_embedding:
          self.decoder_embed = self.embed
      else:
          self.decoder_embed = tf.keras.layers.Embedding(
              self.decode_vocab_size,
              self.embedding_size,
              embeddings_initializer=self.embed_initializer,
          )
  
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 Seq2SeqModel object from inherited base classes: Model with example: obj = Seq2SeqModel(config)