def test_zoo_no_exists(self): with self.assertRaises(ImportError): testing_utils.display_model( {'model_file': 'zoo:unittests/fake', 'task': 'integration_tests',} ) with self.assertRaises(ImportError): testing_utils.display_model( {'model_file': 'zoo:fakemodel', 'task': 'integration_tests'} )
def test_legacy_version(self): # simply tries to load and run some models with versioning attached with self.assertRaises(RuntimeError): testing_utils.display_model({ 'model_file': 'models:convai2/seq2seq/convai2_self_seq2seq_model', 'task': 'convai2', 'no_cuda': True, }) testing_utils.display_model({ 'model': 'legacy:seq2seq:0', 'model_file': 'models:convai2/seq2seq/convai2_self_seq2seq_model', 'task': 'convai2', 'no_cuda': True, })
def test_no_greedy_largebeam(self): """ Ensures that --beam-size > 1 and --inference greedy causes a failure. """ # we should have an exception if we mix beam size > 1 with inference greedy with self.assertRaises(ValueError): testing_utils.display_model( dict( task='integration_tests:multiturn_nocandidate', model_file='zoo:unittest/transformer_generator2/model', beam_size=5, inference='greedy', )) # and we shouldn't if we have inference beam testing_utils.display_model( dict( task='integration_tests:multiturn_nocandidate', model_file='zoo:unittest/transformer_generator2/model', beam_size=5, inference='beam', ))