class_docstr: Extension of Transresnet to incorporate dialogue history and multimodality.
docstr: Forward pass for a text encoder.
  
  :param texts:
      text to encode
  :param dialogue_history:
      flag that indicates whether the text is dialogue history; if False,
      text is a response candidate
  :param batchsize:
      size of the batch
  
  :return:
      encoded representation of the `texts`
docstr_tok: ["Forward","pass","for","a","text","encoder",".",":","param","texts",":","text","to","encode",":","param","dialogue_history",":","flag","that","indicates","whether","the","text","is","dialogue","history",";","if","False",",","text","is","a","response","candidate",":","param","batchsize",":","size","of","the","batch",":","return",":","encoded","representation","of","the","`","texts","`"]
code: def forward_text_encoder(
      self, texts, dialogue_history=False, batchsize=None
  ):
      """
      Forward pass for a text encoder.
  
      :param texts:
          text to encode
      :param dialogue_history:
          flag that indicates whether the text is dialogue history; if False,
          text is a response candidate
      :param batchsize:
          size of the batch
  
      :return:
          encoded representation of the `texts`
      """
      texts_encoded = None
      if texts is None or (
          dialogue_history and not self.encode_dialogue_history
      ):
          if (
              self.multimodal
              and self.multimodal_combo == "concat"
              and dialogue_history
          ):
              texts_encoded = torch.stack(
                  [self.blank_encoding for _ in range(batchsize)]
              )
      else:
          encoder = (
              self.context_encoder
              if dialogue_history
              else self.label_encoder
          )
          indexes, mask = self.captions_to_tensor(texts)
          texts_encoded = encoder(indexes)
          if self.text_encoder_frozen:
              texts_encoded = texts_encoded.detach()
          texts_encoded = self.additional_layer(texts_encoded)
  
      return texts_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 7 for calling the TransresnetMultimodalModel obj's underlying member method code with example usage: obj.forward_text_encoder(texts, dialogue_history, batchsize) and returns: texts_encoded