Ejemplo n.º 1
0
 def run_conversation(mturk_manager, opt, workers):
     task = task_class(task_opt)
     mturk_agent = workers[0]
     world = QADataCollectionWorld(opt=opt,
                                   task=task,
                                   mturk_agent=mturk_agent)
     while not world.episode_done():
         world.parley()
     world.shutdown()
     world.review_work()
Ejemplo n.º 2
0
    def run_hit(hit_index, assignment_index, task_class, task_opt, opt, mturk_manager):
        conversation_id = str(hit_index) + '_' + str(assignment_index)

        task = task_class(task_opt)
        # Create the MTurk agent which provides a chat interface to the Turker
        mturk_agent = MTurkAgent(id=mturk_agent_id, manager=mturk_manager, conversation_id=conversation_id, opt=opt)
        world = QADataCollectionWorld(opt=opt, task=task, mturk_agent=mturk_agent)
        while not world.episode_done():
            world.parley()
        world.shutdown()
        world.review_work()
Ejemplo n.º 3
0
        def run_conversation(mturk_manager, opt, workers):
            # create a task agent to ask the questions
            task = task_class(task_opt)
            # Create the task world
            world = QADataCollectionWorld(opt=opt, task=task, mturk_agent=workers[0])
            # run the world to completion
            while not world.episode_done():
                world.parley()

            # shutdown and review the work
            world.shutdown()
            world.review_work()

            # Return the contents for saving
            return world.prep_save_data(workers)
Ejemplo n.º 4
0
def main():
    argparser = ParlaiParser(False, False)
    argparser.add_parlai_data_path()
    argparser.add_mturk_args()
    opt = argparser.parse_args()
    opt['task'] = os.path.basename(os.getcwd())

    # Initialize a SQuAD teacher agent, which we will later get context from
    module_name = 'parlai.tasks.squad.agents'
    class_name = 'DefaultTeacher'
    my_module = importlib.import_module(module_name)
    task_class = getattr(my_module, class_name)
    task_opt = {}
    task_opt['datatype'] = 'train'
    task_opt['datapath'] = opt['datapath']
    task = task_class(task_opt)

    # Create the MTurk agent which provides a chat interface to the Turker
    opt.update(task_config)
    mturk_agent_id = 'Worker'
    opt['agent_id'] = mturk_agent_id
    opt['mturk_agent_ids'] = [mturk_agent_id]
    opt['all_agent_ids'] = [
        QADataCollectionWorld.collector_agent_id, mturk_agent_id
    ]
    opt['conversation_id'] = str(int(time.time()))

    mturk_agent = MTurkAgent(opt=opt)

    world = QADataCollectionWorld(opt=opt, task=task, mturk_agent=mturk_agent)

    while not world.episode_done():
        world.parley()

    world.shutdown()
Ejemplo n.º 5
0
 def run_hit(i, task_class, task_opt, opt, mturk_manager):
     task = task_class(task_opt)
     # Create the MTurk agent which provides a chat interface to the Turker
     mturk_agent = MTurkAgent(id='Worker', manager=mturk_manager, conversation_id=i, opt=opt)
     world = QADataCollectionWorld(opt=opt, task=task, mturk_agent=mturk_agent)
     while not world.episode_done():
         world.parley()
     world.shutdown()
Ejemplo n.º 6
0
 def run_conversation(mturk_manager, opt, workers):
     task = task_class(task_opt)
     mturk_agent = workers[0]
     world = QADataCollectionWorld(
         opt=opt,
         task=task,
         mturk_agent=mturk_agent
     )
     while not world.episode_done():
         world.parley()
     world.shutdown()
     world.review_work()
Ejemplo n.º 7
0
 def run_hit(i, task_class, task_opt, opt):
     task = task_class(task_opt)
     opt['conversation_id'] = str(i)
     mturk_agent = MTurkAgent(opt=opt)
     world = QADataCollectionWorld(opt=opt,
                                   task=task,
                                   mturk_agent=mturk_agent)
     while not world.episode_done():
         world.parley()
     world.shutdown()