def run_hit(hit_index, assignment_index, opt, mturk_manager): conversation_id = str(hit_index) + '_' + str(assignment_index) # Create mturk agents mturk_agent_1 = MTurkAgent(id=mturk_agent_1_id, manager=mturk_manager, conversation_id=conversation_id, opt=opt) mturk_agent_2 = MTurkAgent(id=mturk_agent_2_id, manager=mturk_manager, conversation_id=conversation_id, opt=opt) # Create the local human agents human_agent_1 = LocalHumanAgent(opt=None) human_agent_1.id = human_agent_1_id human_agent_2 = LocalHumanAgent(opt=None) human_agent_2.id = human_agent_2_id world = MultiAgentDialogWorld(opt=opt, agents=[human_agent_1, human_agent_2, mturk_agent_1, mturk_agent_2]) while not world.episode_done(): world.parley() world.shutdown()
def run_conversation(mturk_manager, opt, workers): # Create mturk agents mturk_agent_1 = workers[0] mturk_agent_2 = workers[1] # Create the local human agents human_agent_1 = LocalHumanAgent(opt=None) human_agent_1.id = human_agent_1_id world = MTurkMultiAgentDialogWorld( opt=opt, agents=[human_agent_1, mturk_agent_1, mturk_agent_2] ) while not world.episode_done(): world.parley() world.shutdown()
def run_conversation(mturk_manager, opt, workers): agents = workers[:] # Create a local agent if not opt['two_mturk_agents']: if 'model' in opt: local_agent = create_agent(opt) else: local_agent = LocalHumanAgent(opt=None) local_agent.id = local_agent_1_id agents.append(local_agent) opt["batchindex"] = mturk_manager.started_conversations world = MTurkDealNoDealDialogWorld( opt=opt, agents=agents ) while not world.episode_done(): world.parley() world.shutdown()
def setup_args(parser=None): if parser is None: parser = ParlaiParser(True, True, 'Interactive chat with a model') parser.add_argument('-d', '--display-examples', type='bool', default=False) parser.add_argument( '--display-prettify', type='bool', default=False, help='Set to use a prettytable when displaying ' 'examples with text candidates', ) parser.add_argument( '--display-ignore-fields', type=str, default='label_candidates,text_candidates', help='Do not display these fields', ) parser.add_argument( '-it', '--interactive-task', type='bool', default=True, help='Create interactive version of task', ) parser.add_argument( '-sc', '--script-chateval', type='bool', default=False, dest='chat_script', help='Chateval script read file' 'True: chateval evaluation, False: single-turn conversation with agent(original model)', ) parser.add_argument( '-scip', '--chateval-input-path', type=str, default=None, dest='script_input_path', help='Chateval script input path', ) parser.add_argument( '-scop', '--chateval-output-path', type=str, default=None, dest='script_output_path', help='Chateval result output path', ) parser.add_argument( '--chateval-multi-num', type=int, default=0, dest='chateval_multi_num', help='True is chateval multiturn setting, turn coverage count.', ) parser.add_argument( '--chateval-multi', type='bool', default=False, hidden=True, dest='chateval_multi', help='True is chateval multiturn setting, False just single turn.', ) parser.set_defaults(interactive_mode=True, task='interactive') LocalHumanAgent.add_cmdline_args(parser) return parser