class_docstr: Extension of Transresnet to incorporate dialogue history and multimodality.
code: def __init__(self, opt, personalities_list, dictionary):
      super().__init__(opt, personalities_list, dictionary)
      self.hidden_dim = self.opt["hidden_dim"]
      self.share_encoder = opt.get("share_encoder")
      nlayers_mm = (
          opt["num_layers_all"]
          if opt["num_layers_all"] != -1
          else opt["num_layers_multimodal_encoder"]
      )
  
      # blank encoding (for concat)
      self.blank_encoding = (
          torch.Tensor(opt["hidden_dim"]).fill_(0).detach_()
      )
      if self.use_cuda:
          self.blank_encoding = self.blank_encoding.cuda()
  
      # Encoders
      self.encode_image = opt.get("encode_image", True)
      self.encode_personality = opt.get("encode_personality", True)
      self.encode_dialogue_history = opt.get(
          "encode_dialogue_history", True
      )
      assert any(
          [
              self.encode_dialogue_history,
              self.encode_image,
              self.encode_personality,
          ]
      )
  
      # Transformer 2
      self._build_multimodal_encoder(nlayers_mm)
  
      # Label Encoder
      self.label_encoder = self.text_encoder
  
      # Context encoder
      self._build_context_encoder()
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  import torch
  from torch import nn
  from parlai.utils.io import PathManager
  from parlai.agents.transformer.modules import TransformerEncoder, create_position_codes, TransformerEncoderLayer
  from projects.personality_captions.transresnet.modules import TransresnetModel, load_fasttext_embeddings
label_desc: Use image node_id 2 to create a new TransresnetMultimodalModel object from inherited base classes: TransresnetModel with example: obj = TransresnetMultimodalModel(opt, personalities_list, dictionary)