5

I followed the steps on the Predicting Movie Reviews with BERT on TF Hub here.

At the end, how do I export the model to be used/loaded as a classifier later?

I found a link that shows that I can export the estimator as a tf.saved_model. However, I got stuck on creating the 'serving_input_receiver_fn()'.

tomerpacific
  • 4,704
  • 13
  • 34
  • 52
ebaik
  • 59
  • 4

1 Answers1

0

Use pickle to save the model

import pickle
# save the model to disk
filename = 'finalized_model.sav'
pickle.dump(model, open(filename, 'wb'))

#Load the model
loaded_model = pickle.load(open(filename, 'rb'))
Emeka Boris Ama
  • 429
  • 4
  • 5