示例#1
0
    def test_testing(self, simple_model, loss, simple_data):
        """ Tests that a testing run can succeed.
		"""
        simple_model.parse(None)
        simple_model.build()
        trainer = Executor(model=simple_model, loss=loss)
        trainer.test(providers={'default': simple_data})
示例#2
0
    def test_evaluator(self, simple_model):
        """ Tests if we can compile an Executor instance.
		"""
        simple_model.parse(None)
        simple_model.build()
        evaluator = Executor(model=simple_model)
        evaluator.compile()
示例#3
0
    def test_trainer_without_optimizer(self, simple_model, loss):
        """ Tests if we can compile a Executor instance without an optimizer.
		"""
        simple_model.parse(None)
        simple_model.build()
        trainer = Executor(model=simple_model, loss=loss)
        trainer.compile()
示例#4
0
    def test_training(self, simple_model, loss, optimizer, simple_data):
        """ Tests that a single training epoch can succeed.
		"""
        simple_model.parse(None)
        simple_model.build()
        trainer = Executor(model=simple_model, loss=loss, optimizer=optimizer)
        trainer.train(provider=simple_data, stop_when={'epochs': 1})
示例#5
0
    def test_evaluating(self, simple_model, simple_data):
        """ Tests that an evaluation run can succeed.
		"""
        simple_model.parse(None)
        simple_model.build()
        evaluator = Executor(model=simple_model)
        evaluator.evaluate(provider=simple_data)
示例#6
0
    def test_embedding_evaluating(self, embedding_model, embedding_data):
        """ Tests that we can evaluate a model that has an Embedding.
		"""
        embedding_model.parse(None)
        embedding_model.register_provider(embedding_data)
        embedding_model.build()
        evaluator = Executor(model=embedding_model)
        evaluator.evaluate(provider=embedding_data)
示例#7
0
    def test_uber_evaluating(self, uber_model, uber_data, jinja_engine):
        """ Tests that we can evaluate a very diverse model.
		"""
        uber_model.parse(jinja_engine)
        uber_model.register_provider(uber_data)
        uber_model.build()
        evaluator = Executor(model=uber_model)
        evaluator.evaluate(provider=uber_data)
示例#8
0
    def test_ctc_evaluating(self, ctc_model, ctc_eval_data):
        """ Tests that we can evaluate a model that was trained with CTC loss.
		"""
        ctc_model.parse(None)
        ctc_model.register_provider(ctc_eval_data)
        ctc_model.build()
        evaluator = Executor(model=ctc_model)
        evaluator.evaluate(provider=ctc_eval_data)
示例#9
0
    def test_embedding_test(self, embedding_model, embedding_data, loss):
        """ Tests that we can compile and test a model which has an Embedding.
			function.
		"""
        embedding_model.parse(None)
        embedding_model.register_provider(embedding_data)
        embedding_model.build()
        trainer = Executor(model=embedding_model, loss=loss)
        trainer.test(providers={'default': embedding_data})
示例#10
0
    def test_uber_test(self, uber_model, uber_data, jinja_engine, loss):
        """ Tests that we can compile and test a diverse model.
		"""
        uber_model.parse(jinja_engine)
        uber_model.register_provider(uber_data)
        uber_model.build()
        trainer = Executor(model=uber_model, loss=loss)
        trainer.compile()
        trainer.test(providers={'default': uber_data})
示例#11
0
    def test_ctc_test(self, ctc_model, ctc_data, ctc_loss):
        """ Tests that we can compile and test a model using the CTC loss
			function.
		"""
        ctc_model.parse(None)
        ctc_model.register_provider(ctc_data)
        ctc_model.build()
        trainer = Executor(model=ctc_model, loss=ctc_loss)
        trainer.test(providers={'default': ctc_data})
示例#12
0
    def test_ctc_train(self, ctc_model, ctc_data, ctc_loss, optimizer):
        """ Tests that we can compile and train a model using the CTC loss
			function.
		"""
        ctc_model.parse(None)
        ctc_model.register_provider(ctc_data)
        ctc_model.build()
        trainer = Executor(model=ctc_model, loss=ctc_loss, optimizer=optimizer)
        trainer.train(provider=ctc_data, stop_when={'epochs': 1})
示例#13
0
    def test_uber_train(self, uber_model, uber_data, jinja_engine, loss,
                        optimizer):
        """ Tests that we can compile and train a diverse model.
		"""
        uber_model.parse(jinja_engine)
        uber_model.register_provider(uber_data)
        uber_model.build()
        trainer = Executor(model=uber_model, loss=loss, optimizer=optimizer)
        trainer.compile()
        trainer.train(provider=uber_data, stop_when={'epochs': 1})
示例#14
0
    def test_embedding_train(self, embedding_model, embedding_data, loss,
                             optimizer):
        """ Tests that we can compile and train a model which has an Embedding.
		"""
        embedding_model.parse(None)
        embedding_model.register_provider(embedding_data)
        embedding_model.build()
        trainer = Executor(model=embedding_model,
                           loss=loss,
                           optimizer=optimizer)
        trainer.train(provider=embedding_data, stop_when={'epochs': 1})
示例#15
0
    def test_uber_train(self, uber_model, uber_data, jinja_engine, loss,
                        optimizer):
        """ Tests that we can compile and train a diverse model.
		"""
        if uber_model.get_backend().get_name() == 'keras' and \
         uber_model.get_backend().keras_version() == 2 and \
         uber_model.get_backend().get_toolchain() == 'tensorflow' and \
         sys.version_info < (3, 5):
            pytest.skip('Occassional SIGSEGV')

        uber_model.parse(jinja_engine)
        uber_model.register_provider(uber_data)
        uber_model.build()
        trainer = Executor(model=uber_model, loss=loss, optimizer=optimizer)
        trainer.compile()
        trainer.train(provider=uber_data, stop_when={'epochs': 1})