def test_cornell_movie(self): from parlai.core.params import ParlaiParser from parlai.tasks.cornell_movie.agents import DefaultTeacher opt = ParlaiParser().parse_args(args=self.args) for dt in ['train:ordered', 'valid', 'test']: opt['datatype'] = dt teacher = DefaultTeacher(opt) reply = teacher.act() check(opt, reply) shutil.rmtree(self.TMP_PATH)
def test_fvqa(self): from parlai.core.params import ParlaiParser parser = ParlaiParser() parser.add_task_args(['-t', 'fvqa']) opt = parser.parse_args(args=self.args) from parlai.tasks.fvqa.agents import DefaultTeacher for dt in ['train:ordered', 'test']: opt['datatype'] = dt teacher = DefaultTeacher(opt) reply = teacher.act() check(opt, reply) shutil.rmtree(self.TMP_PATH)
def test_copa(self): from parlai.core.params import ParlaiParser from parlai.tasks.copa.agents import DefaultTeacher opt = ParlaiParser().parse_args(args=self.args) for dt in ['train', 'valid', 'test']: opt['datatype'] = dt teacher = DefaultTeacher(opt) reply = teacher.act() check(opt, reply) assert len(reply.get('label_candidates')) == 2 shutil.rmtree(self.TMP_PATH)
def test_ms_marco(self): from parlai.core.params import ParlaiParser from parlai.tasks.ms_marco.agents import DefaultTeacher, PassageTeacher opt = ParlaiParser().parse_args(args=self.args) for dt in ['train', 'valid']: opt['datatype'] = dt teacher = DefaultTeacher(opt) reply = teacher.act() check(opt, reply) teacher = PassageTeacher(opt) reply = teacher.act() check(opt, reply) shutil.rmtree(self.TMP_PATH)
def test_squad(self): from parlai.core.params import ParlaiParser from parlai.tasks.squad.agents import (DefaultTeacher, HandwrittenTeacher) opt = ParlaiParser().parse_args(args=self.args) for dt in ['train:ordered', 'valid']: opt['datatype'] = dt teacher = DefaultTeacher(opt) reply = teacher.act() check(opt, reply) teacher = HandwrittenTeacher(opt) reply = teacher.act() check(opt, reply) shutil.rmtree(self.TMP_PATH)
def test_multinli(self): from parlai.core.params import ParlaiParser from parlai.tasks.multinli.agents import DefaultTeacher opt = ParlaiParser().parse_args(args=self.args) for dt in ['train', 'valid', 'test']: opt['datatype'] = dt teacher = DefaultTeacher(opt) reply = teacher.act() check(opt, reply) assert len(reply.get('label_candidates')) == 3 assert reply.get('text').find('Premise') != -1 assert reply.get('text').find('Hypothesis') != -1 if dt == 'train': assert reply.get('labels')[0] in [ 'entailment', 'contradiction', 'neutral' ] shutil.rmtree(self.TMP_PATH)
def test_narrative_qa(self): from parlai.core.params import ParlaiParser from parlai.tasks.narrative_qa.agents import DefaultTeacher, SummariesTeacher opt = ParlaiParser().parse_args(args=self.args) for dt in ['train', 'valid', 'test']: opt['datatype'] = dt teacher = DefaultTeacher(opt) reply = teacher.act() check(opt, reply) shutil.rmtree(self.TMP_PATH) for dt in ['train', 'valid', 'test']: opt['datatype'] = dt teacher = SummariesTeacher(opt) reply = teacher.act() check(opt, reply) shutil.rmtree(self.TMP_PATH)
def test_coco_datasets(self): # one unit test for tasks with coco so images are only downloaded once from parlai.core.params import ParlaiParser opt = ParlaiParser().parse_args(args=self.args) # VisDial from parlai.tasks.visdial.agents import DefaultTeacher for dt in ['train:ordered', 'valid']: opt['datatype'] = dt teacher = DefaultTeacher(opt) reply = teacher.act() check(opt, reply) # VQA_v1 from parlai.tasks.vqa_v1.agents import McTeacher, OeTeacher for dt in ['train:ordered', 'valid', 'test']: opt['datatype'] = dt teacher = McTeacher(opt) reply = teacher.act() check(opt, reply) teacher = OeTeacher(opt) reply = teacher.act() check(opt, reply) # VQA_v2 from parlai.tasks.vqa_v2.agents import OeTeacher for dt in ['train:ordered', 'valid', 'test']: opt['datatype'] = dt teacher = OeTeacher(opt) reply = teacher.act() check(opt, reply) shutil.rmtree(self.TMP_PATH)