Esempio n. 1
0
def test_compile_model(config: Configuration):
    model = DeepSpeech.get_model(**config.model, is_gpu=False)
    optimizer = DeepSpeech.get_optimizer(**config.optimizer)
    loss = DeepSpeech.get_loss()
    DeepSpeech.compile_model(model, optimizer, loss)
    assert model._is_compiled
Esempio n. 2
0
def test_get_decoder(config: Configuration, alphabet: Alphabet):
    model = DeepSpeech.get_model(**config.model, is_gpu=False)
    decoder = DeepSpeech.get_decoder(alphabet=alphabet,
                                     model=model,
                                     **config.decoder)
    assert callable(decoder)
Esempio n. 3
0
def test_get_callbacks(test_dir: str, config: Configuration):
    model = DeepSpeech.get_model(**config.model, is_gpu=False)
    callbacks = DeepSpeech.get_callbacks(home_dir=test_dir,
                                         configurations=config.callbacks,
                                         model=model)
    assert len(callbacks) == 2
Esempio n. 4
0
def test_get_model(config: Configuration):
    model = DeepSpeech.get_model(**config.model, is_gpu=False)
    assert type(model) == Model
    new_model = DeepSpeech.get_model(**config.model, is_gpu=False)
    assert is_same(model.get_weights(),
                   new_model.get_weights())  # Test random seed