code: def __init__(self, config, **kwargs):
      super().__init__(**kwargs)
      self.config = config
      config = self.config
      model_config = config["model"]["net"]["structure"]
      self.num_classes = config["data"]["task"]["classes"]["num"]
      self.vocab_size = config["data"]["task"]["text"]["vocab_size"]
      self.max_text_len = config["data"]["task"]["text"]["max_text_len"]
      self.use_pretrained_embedding = config["model"][
          "use_pre_train_emb"
      ]
      self.embedding_size = model_config["embedding_size"]
      self.hidden_dim = model_config["hidden_dim"]
      self.head_num = model_config["head_num"]
      self.inner_size = model_config["inner_size"]
      self.dropout_rate = model_config["dropout_rate"]
      self.speech_dropout_rate = model_config["speech_dropout_rate"]
      self.padding_id = model_config.get("padding_id", 0)
      self.speech_dense_act = config.get("speech_dense_act", "relu")
  
      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.speech_enc_layer = delta.layers.RnnEncoder(
          config, name="speech_encoder"
      )
      self.text_enc_layer = delta.layers.RnnEncoder(
          config, name="text_encoder"
      )
  
      self.align_attn_layer = delta.layers.MultiHeadAttention(
          self.hidden_dim, self.head_num
      )
      self.align_enc_layer = delta.layers.RnnAttentionEncoder(
          config, name="align_encoder"
      )
  
      self.embed_d = tf.keras.layers.Dropout(self.dropout_rate)
      self.speech_d = tf.keras.layers.Dropout(self.speech_dropout_rate)
      self.speech_enc_d = tf.keras.layers.Dropout(
          self.speech_dropout_rate
      )
      self.text_enc_d = tf.keras.layers.Dropout(self.dropout_rate)
      self.attn_enc_d = tf.keras.layers.Dropout(self.dropout_rate)
      self.align_enc_d = tf.keras.layers.Dropout(self.dropout_rate)
      self.final_dense = tf.keras.layers.Dense(
          self.num_classes, activation=tf.keras.activations.linear
      )
  
      self.align_layer_norm = tf.keras.layers.LayerNormalization(
          epsilon=1e-6
      )
      self.speech_dense = tf.keras.layers.Dense(
          512, activation=self.speech_dense_act
      )
  
file_path: delta/delta/models/multimodal_cls_model.py
imports: import numpy
  from absl import logging
  import delta.compat
  import delta.layers
  from delta.models.base_model import Model
  from delta.utils.register import registers
  from delta.layers.utils import get_expand_pad_mask
  import pickle
label_desc: Use image node_id 1 to create a new AlignClassModel object from inherited base classes: Model with example: obj = AlignClassModel(config)