class_docstr: Modular agent mixin.
  
  Provides shared functionality across modular agents (seeker, BB3)
docstr: Given an agent opt, construct the new opt for the agent.
  
  :param filename:
      opt path
  :param specific_override_args:
      args for the specific agent
  :param general_override_args:
      args specified for all agents
docstr_tok: ["Given","an","agent","opt",",","construct","the","new","opt","for","the","agent",".",":","param","filename",":","opt","path",":","param","specific_override_args",":","args","for","the","specific","agent",":","param","general_override_args",":","args","specified","for","all","agents"]
code: def get_subagent_opt(
      self,
      datapath: str,
      filename: str,
      specific_override_args: Dict[str, Any],
      general_override_args: Dict[str, Any],
  ) -> Opt:
      """
      Given an agent opt, construct the new opt for the agent.
  
      :param filename:
          opt path
      :param specific_override_args:
          args for the specific agent
      :param general_override_args:
          args specified for all agents
      """
      if not filename.endswith(".opt"):
          filename += ".opt"
      opt = Opt.load(modelzoo_path(datapath, filename))
      opt["override"] = {}
      blocklist_general = ["model", "model_file", "init_model"]
      general_override_args["skip_generation"] = False
  
      # Remove the prefix for the model for the specific override args.
      specific_override_args = {
          "_".join(k.split("_")[1:]): v
          for k, v in specific_override_args.items()
      }
  
      override_args = {
          **general_override_args,
          **specific_override_args,
      }
  
      for k, v in override_args.items():
          if k not in blocklist_general and k in opt:
              logging.warning(
                  f"Overriding {k} to {v} (old val: {opt[k]})"
              )
              opt["override"][k] = v
          elif k in specific_override_args:
              logging.warning(
                  f"Key {k} not originally in opt, setting to {v}"
              )
              opt["override"][k] = v
  
      return opt
  
file_path: ParlAI/projects/seeker/agents/modular_agent.py
imports: from abc import ABC
  from typing import Dict, Any, List
  from parlai.core.agents import Agent
  from parlai.core.build_data import modelzoo_path
  from parlai.core.message import Message
  from parlai.core.opt import Opt
  from parlai.core.loader import load_agent_module
  import parlai.utils.logging
label_desc: Use image node_id 2 for calling the ModularAgentMixin obj's underlying member method code with example usage: obj.get_subagent_opt(datapath, filename, specific_override_args, general_override_args) and returns: opt