docstr: Hack.
  
  `create_agent` expects opt[`model`] to specify the model type and we're
  specifying multiple models from other opt arguments (ex.
  `system_model`/`user_model` etc), so this swaps it in.
docstr_tok: ["Hack",".","`","create_agent","`","expects","opt","[","`","model","`","]","to","specify","the","model","type","and","we're","specifying","multiple","models","from","other","opt","arguments","(","ex",".","`","system_model","`","\/","`","user_model","`","etc",")",",","so","this","swaps","it","in","."]
code: def _make_agent(
      self, opt_raw, name, requireModelExists=False, opt_key="model"
  ):
      """
      Hack.
  
      `create_agent` expects opt[`model`] to specify the model type and we're
      specifying multiple models from other opt arguments (ex.
      `system_model`/`user_model` etc), so this swaps it in.
      """
      opt = deepcopy(opt_raw)
      opt[opt_key] = opt[name]
      print(opt_key, name)
      return create_agent(opt, requireModelExists)
  
imports: import json
  from copy import deepcopy
  from shutil import copyfile
  import os
  import parlai.utils.logging
  import parlai.core.tod.tod_world
  import parlai.core.tod.tod_agents
  from parlai.core.agents import create_agent
  from parlai.core.metrics import dict_report, aggregate_unnamed_reports
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  from parlai.core.script import ParlaiScript, register_script
  from parlai.utils.distributed import is_primary_worker, all_gather_list, is_distributed, get_rank, sync_object, num_workers
  from parlai.utils.io import PathManager
  from parlai.utils.misc import TimeLogger, nice_report
  from parlai.utils.world_logging import WorldLogger
label_desc: Use image node_id 6 for calling the TodWorldScript obj's underlying member method code with example usage: obj._make_agent(opt_raw, name, requireModelExists, opt_key) and returns: create_agent