-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chapter 12 Text generation how do i save and load models? #233
Comments
I have received your E-mail——Steven Lee
|
You can save a keras model after training by calling the save() function: Alternatively you could just save the models weights: The above would save the model to your current directory. To load the model: There are of course other ways to save your model. For instance if you are using a callback during training such as a model checkpoint. I hope this is helpful. |
i tried that, i was able to save the model but while loading the model i got the following error. I think the PositionalEmbeddings have not been taken into account. i got this error
|
If you are using a custom layer then you need to specify this when calling load_model():
This is assuming that you have defined a custom layer in your model. |
Loaded the model. Now i get this error
|
Hello.. I have a same issue. Chapter 11. Transformer Translatation from Eng to Spanish have a same issue. ` class TransformerEncoder(layers.Layer): class TransformerDecoder(layers.Layer): ... transformer_model.save('model/eng_spa_transformer') new_model = keras.models.load_model('model/eng_spa_transformer', custom_objects={'TransformerDecoder': TransformerDecoder, Load new_model is ok but... new_model can't predict well.. The problem is that eng_spa_transformer/assets directory is empy... Any help? |
I am triying to save the model used in chapter 12, text generation but cannot do so. How would i be able to save it?
And load it back?
Thanks
The text was updated successfully, but these errors were encountered: