class_docstr: Model from "Engaging Image Chat: Modeling Personality in Grounded Dialogue".
  
  See paper for more details: (https://arxiv.org/abs/1811.00945)
  
  An extension of the model from https://arxiv.org/abs/1810.10665; given
  an image, personality, and dialogue history, predicts the next utterance
  in a dialogue.
class_docstr_tok: ["Model","from","``","Engaging","Image","Chat",":","Modeling","Personality","in","Grounded","Dialogue","''",".","See","paper","for","more","details",":","(","https",":","\/\/arxiv.org\/abs\/1811.00945",")","An","extension","of","the","model","from","https",":","\/\/arxiv.org\/abs\/1810.10665",";","given","an","image",",","personality",",","and","dialogue","history",",","predicts","the","next","utterance","in","a","dialogue","."]
code: def __init__(self, opt, shared=None):
      super().__init__(opt, shared)
      self.metrics = {
          k: {
              "hits@1/100": 0.0,
              "loss": 0.0,
              "num_samples": 0,
              "med_rank": [],
          }
          for k in ["first_round", "second_round", "third_round+"]
      }
      if shared is None:
          self.optimizer = optim.Adam(
              filter(
                  lambda p: p.requires_grad, self.model.parameters()
              ),
              self.opt["learningrate"],
          )
      else:
          self.optimizer = shared["optimizer"]
  
      self.history = deque(maxlen=None)
      self.personality_override = opt.get("personality_override")
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from parlai.utils.misc import round_sigfigs
  from parlai.core.message import Message
  from .modules import TransresnetMultimodalModel
  from projects.personality_captions.transresnet.transresnet import TransresnetAgent
  from parlai.utils.io import PathManager
  import parlai.utils.torch
  import torch
  from torch import optim
  import random
  import numpy
  import tqdm
  from collections import deque
label_desc: Use image node_id 2 to create a new TransresnetMultimodalAgent object from inherited base classes: TransresnetAgent with example: obj = TransresnetMultimodalAgent(opt, shared)