class_docstr: Information Retrieval baseline.
docstr: Initialize agent.
docstr_tok: ["Initialize","agent","."]
code: def __init__(self, opt, shared=None):
      """
      Initialize agent.
      """
      super().__init__(opt)
      self.id = "IRBaselineAgent"
      self.length_penalty = float(opt["length_penalty"])
      self.dictionary = DictionaryAgent(opt)
      self.opt = opt
      self.history = []
      self.episodeDone = True
      if opt.get("label_candidates_file"):
          f = open(opt.get("label_candidates_file"))
          self.label_candidates = f.read().split("\n")
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  import math
  from collections.abc import Sequence
  import heapq
  import json
  import parlai.utils.torch
  from parlai.core.agents import Agent
  from parlai.core.dict import DictionaryAgent
  from parlai.utils.io import PathManager
label_desc: Use image node_id 3 to create a new IrBaselineAgent object from inherited base classes: Agent with example: obj = IrBaselineAgent(opt, shared)