Saving Model for Ranking
I was curious since the model.save() command won't work and since for retrieval we have the index.save() (which thankfully does), how one could save the ranking aspect and use it later on? I thought of saving the checkpoint and reloading it later, but I am not really sure if that works.
I updated the ranking tutorial to make it work for export by default. You can have a look at the commit for details.
I updated the ranking tutorial to make it work for export by default. You can have a look at the commit for details.
Thanks a lot for the reply, much more than what I anticipated. What I did till now was to use model.sequence_model.save('...') and model.user_model.save('...') to save the two tower models of my multi-task recommender and then I saved the weights as well. I then only kept the code for the CombinedModel.
self.product_model = tf.keras.models.load_model('models/cb_aug24_product_model', compile=False)
self.sequence_model = tf.keras.models.load_model('models/cb_aug24_sequence_model', compile=False)
Of course that also required saving the tensorflow datasets for the candidates. Therefore in the mini-flask app I created to showcase the RS, I loaded these with the indexes without adding too much time to the overall setup duration.
Hello, can you send the detailed code for saving the model? I want to save the model now, but I don't know how to implement it