class_docstr: Model described in (https://arxiv.org/abs/1811.00945).
  
  A model for producing engaging captions about an image. Given an image and
  this model will attempt to predict an appropriate
  next utterance in the dialog, in the context of a given personality.
  
  See the paper linked above for more information.
class_docstr_tok: ["Model","described","in","(","https",":","\/\/arxiv.org\/abs\/1811.00945",")",".","A","model","for","producing","engaging","captions","about","an","image",".","Given","an","image","and","this","model","will","attempt","to","predict","an","appropriate","next","utterance","in","the","dialog",",","in","the","context","of","a","given","personality",".","See","the","paper","linked","above","for","more","information","."]
code: def __init__(self, opt, shared=None):
      self.metrics = {
          "hits@1/100": 0.0,
          "loss": 0.0,
          "num_samples": 0,
          "med_rank": [],
      }
      self.blank_image_features = torch.FloatTensor(
          opt.get("image_features_dim")
      ).fill_(0)
      self.opt = opt
      self.model_file = opt["model_file"]
      self.id = "TransresnetAgent"
      self.one_cand_set = opt.get("one_cand_set", False)
      self.use_cuda = not opt["no_cuda"] and torch.cuda.is_available()
      self.fcp = None
      if opt.get("fixed_cands_path") is not None:
          self.fcp = opt["fixed_cands_path"]
      self.episode_done = True
  
      if not shared:
          # setup dict
          self._setup_dict()
          # load the list of personalities
          self.personalities_list = self.load_personalities()
          # possibly load the model from a model file
          self._build_model()
          # load candidates if specified
          self._setup_cands()
          self.freeze_patience = self.opt["freeze_patience"]
          if self.freeze_patience != -1:
              # For fine-tuning
              self.model.freeze_text_encoder()
              self.freeze_impatience = 0
              self.freeze_best_metric = 0
              self.is_frozen = True
      else:
          self.dict = shared["dict"]
          self.model = shared["model"]
          self.personalities_list = shared["personalities_list"]
          self.fixed_cands = shared["fixed_cands"]
          self.fixed_cands_enc = shared["fixed_cands_enc"]
  
      super().__init__(opt, shared)
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from parlai.core.agents import Agent
  from parlai.core.dict import DictionaryAgent
  from parlai.utils.misc import round_sigfigs
  from .modules import TransresnetModel
  from parlai.tasks.personality_captions.build import build
  from parlai.utils.io import PathManager
  import parlai.utils.torch
  import os
  import random
  import json
  import numpy
  import torch
  import tqdm
label_desc: Use image node_id 3 to create a new TransresnetAgent object from inherited base classes: Agent with example: obj = TransresnetAgent(opt, shared)