class_docstr: Extension of Transresnet to incorporate dialogue history and multimodality.
docstr: Encode personalities.
  
  :param personalities:
      list of personalities, one per example
  :param personalities_tensor:
      (optional) list of personality representations, usually a one-hot
      vector if specified
  
  :return:
      encoded representation of the personalities
docstr_tok: ["Encode","personalities",".",":","param","personalities",":","list","of","personalities",",","one","per","example",":","param","personalities_tensor",":","(","optional",")","list","of","personality","representations",",","usually","a","one-hot","vector","if","specified",":","return",":","encoded","representation","of","the","personalities"]
code: def forward_personality(self, personalities, personalities_tensor):
      """
      Encode personalities.
  
      :param personalities:
          list of personalities, one per example
      :param personalities_tensor:
          (optional) list of personality representations, usually a one-hot
          vector if specified
  
      :return:
          encoded representation of the personalities
      """
      pers_encoded = None
      if not self.encode_personality:
          if self.multimodal and self.multimodal_combo == "concat":
              pers_encoded = self.blank_encoding
      else:
          pers_encoded = super().forward_personality(
              personalities, personalities_tensor
          )
      return pers_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 6 for calling the TransresnetMultimodalModel obj's underlying member method code with example usage: obj.forward_personality(personalities, personalities_tensor) and returns: pers_encoded