Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23276

save and load keras transformer model

$
0
0

i am still new to deep learning right now i follow this keras tutorial to make an translation model using transformer here the link. Everything works just fine but i have no idea how to save the model, currently i have this implementation

transformer.save("models/transformer.h5")

and load the model with this

new_model = tf.keras.models.load_model("models/transformer.h5",    custom_objects={"PositionalEmbedding": PositionalEmbedding,"TransformerEncoder": TransformerEncoder,"TransformerDecoder": TransformerDecoder,    },)new_model.summary()

i also attempt to save the vectorization and load it with pickle following thisbut when i use the model outside the notebook the model is worsen, when i load the model in the same notebook it just fine (without reloading the vectorization)

can someone guide me how to correctly how to save this model?


Viewing all articles
Browse latest Browse all 23276

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>