Loading models

We can load the models we saved in the training script with keras.models.load_model. I created this helper to do just that. We will load the model using the following code:

def load_models():    model = load_model('char_s2s.h5')    encoder_model = load_model('char_s2s_encoder.h5')    decoder_model = load_model('char_s2s_decoder.h5')    return [model, encoder_model, decoder_model]

We can just call the following function to load all the three models:

model, encoder_model, decoder_model = load_models()

Get Deep Learning Quick Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.