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","."]
docstr: Update Metrics.
  
  Overridden to include dialogue round
  
  :param loss:
      float loss
  :param num_correct:
      number of examples for which chosen caption is correct
  :param num_samples:
      total number of examples
  :param med_rank:
      rank of correct caption for each example
docstr_tok: ["Update","Metrics",".","Overridden","to","include","dialogue","round",":","param","loss",":","float","loss",":","param","num_correct",":","number","of","examples","for","which","chosen","caption","is","correct",":","param","num_samples",":","total","number","of","examples",":","param","med_rank",":","rank","of","correct","caption","for","each","example"]
code: def update_metrics(
      self,
      loss,
      num_correct,
      num_samples,
      dialogue_round,
      med_rank=None,
  ):
      """
      Update Metrics.
  
      Overridden to include dialogue round
  
      :param loss:
          float loss
      :param num_correct:
          number of examples for which chosen caption is correct
      :param num_samples:
          total number of examples
      :param med_rank:
          rank of correct caption for each example
      """
      self.metrics[dialogue_round]["hits@1/100"] += num_correct
      self.metrics[dialogue_round]["loss"] += loss
      self.metrics[dialogue_round]["num_samples"] += num_samples
      if med_rank:
          self.metrics[dialogue_round]["med_rank"] += med_rank
  
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 12 for calling the TransresnetMultimodalAgent obj's underlying member method code with example usage: obj.update_metrics(loss, num_correct, num_samples, dialogue_round, med_rank) without return types