Beispiel #1
0
 def add_cmdline_args(argparser: ParlaiParser) -> None:
     """
     Add command-line arguments specifically for this task world.
     """
     InteractiveBaseWorld.add_cmdline_args(argparser)
     parser = argparser.add_argument_group('RetNRef Interactive World Args')
     parser.add_argument(
         '--print-checked-sentence',
         type='bool',
         default=True,
         help='Print sentence that the model checks.',
     )
     parser.add_argument(
         '--add-token-knowledge',
         type='bool',
         default=False,
         help='Add knowledge token to retrieved knowledge',
     )
    def test_share(self, mock_load_personas):
        test_personas = ['your persona:I live on a pirate\'s shoulder']
        with testing_utils.tempdir() as data_path:
            mock_load_personas.return_value = test_personas
            kwargs = {
                'task': 'blended_skill_talk',
                'datapath': data_path,
                'interactive_task': True,
                'interactive_mode': True,
            }
            parser = setup_args()
            parser.set_defaults(**kwargs)
            opt = parser.parse_args([])
            agent = RepeatLabelAgent(opt)
            agent2 = agent.clone()
            world = InteractiveWorld(opt=opt, agents=[agent, agent2])
            # We should not reload personas on share
            mock_load_personas.return_value = None
            new_world = world.clone()

            self.assertEqual(new_world.contexts_data, test_personas)