Issue in saving/loading model

I am trying to reproduce the Image Captioning model shared by tensorflow in this blog: Image captioning with visual attention  |  Text  |  TensorFlow

However, when I am trying to save/load the model I am getting the following error:

Kindly help on how to resolve it

@Nityam_Pareek,

Welcome to the Tensorflow Forum,

I see that you are adding model.build while loading the weights which is not a right approach. The model is built while saving the weights and therefore when it is built on a new model instance with random weights, we face the error.

Please find the working gist for reference.

Thank you!

1 Like