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: Receive the metrics from validation.
  
  Unfreeze text encoder weights after a certain number of rounds without improvement.
  
  Override to account for different dialogue rounds.
  
  :param metrics_dict:
      the metrics dictionary
docstr_tok: ["Receive","the","metrics","from","validation",".","Unfreeze","text","encoder","weights","after","a","certain","number","of","rounds","without","improvement",".","Override","to","account","for","different","dialogue","rounds",".",":","param","metrics_dict",":","the","metrics","dictionary"]
code: def receive_metrics(self, metrics_dict):
      """
      Receive the metrics from validation.
  
      Unfreeze text encoder weights after a certain number of rounds without improvement.
  
      Override to account for different dialogue rounds.
  
      :param metrics_dict:
          the metrics dictionary
      """
      if "tasks" in metrics_dict:
          metrics_dict = metrics_dict["tasks"][
              "internal:comment_battle:imageDialog"
          ]
      if self.freeze_patience != -1 and self.is_frozen:
          m_key = "hits@1/100"
          ms = [
              metrics_dict[r].get(m_key, -1)
              for r in ["first_round", "second_round", "third_round+"]
          ]
          m = sum(ms) / len([m for m in ms if m >= 0])
          if m > self.freeze_best_metric:
              self.freeze_impatience = 0
              self.freeze_best_metric = m
              print(
                  "performance not good enough to unfreeze the model."
              )
          else:
              self.freeze_impatience += 1
              print("Growing impatience for unfreezing")
              if self.freeze_impatience >= self.freeze_patience:
                  self.is_frozen = False
                  print(
                      "Reached impatience for fine tuning. "
                      "Reloading the best model so far."
                  )
                  self._build_model(self.model_file)
                  if self.use_cuda:
                      self.model = self.model.cuda()
                  print("Unfreezing.")
                  self.model.unfreeze_text_encoder()
                  print("Done")
  
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 13 for calling the TransresnetMultimodalAgent obj's underlying member method code with example usage: obj.receive_metrics(metrics_dict) without return types