class_docstr: Extension of Transresnet to incorporate dialogue history and multimodality.
docstr: Model forward pass.
  
  :param image_features:
      list of tensors of image features, one per example
  :param personalities:
      list of personalities, one per example
  :param dialogue_histories:
      list of dialogue histories, one per example
  :param labels:
      list of response labels, one per example
  :param personalities_tensor:
      (optional) list of personality representations, usually a one-hot
      vector if specified
  
  :return:
      the encoded context and the encoded captions.
docstr_tok: ["Model","forward","pass",".",":","param","image_features",":","list","of","tensors","of","image","features",",","one","per","example",":","param","personalities",":","list","of","personalities",",","one","per","example",":","param","dialogue_histories",":","list","of","dialogue","histories",",","one","per","example",":","param","labels",":","list","of","response","labels",",","one","per","example",":","param","personalities_tensor",":","(","optional",")","list","of","personality","representations",",","usually","a","one-hot","vector","if","specified",":","return",":","the","encoded","context","and","the","encoded","captions","."]
code: def forward(
      self,
      image_features,
      personalities,
      dialogue_histories,
      labels,
      batchsize=None,
      personalities_tensor=None,
  ):
      """
      Model forward pass.
  
      :param image_features:
          list of tensors of image features, one per example
      :param personalities:
          list of personalities, one per example
      :param dialogue_histories:
          list of dialogue histories, one per example
      :param labels:
          list of response labels, one per example
      :param personalities_tensor:
          (optional) list of personality representations, usually a one-hot
          vector if specified
  
      :return:
          the encoded context and the encoded captions.
      """
      # labels
      labels_encoded = self.forward_text_encoder(labels)
      # dialog history
      d_hist_encoded = self.forward_text_encoder(
          dialogue_histories, dialogue_history=True, batchsize=batchsize
      )
      # images
      img_encoded = self.forward_image(image_features)
      # personalities
      pers_encoded = self.forward_personality(
          personalities, personalities_tensor
      )
      total_encoded = self.get_rep(
          [img_encoded, d_hist_encoded, pers_encoded],
          batchsize=batchsize,
      )
      loss, nb_ok = self.get_loss(total_encoded, labels_encoded)
  
      return loss, nb_ok, total_encoded
  
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 5 for calling the TransresnetMultimodalModel obj's underlying member method code with example usage: obj.forward(image_features, personalities, dialogue_histories, labels, batchsize, personalities_tensor) and returns: loss,  nb_ok,  total_encoded