How to save a model with text vectorizer & embedding in .h5 format?

Same question asked here:

The question was closed without an answer, so I will reopen it. I had a model that I got around 90% accuracy, but was unable to submit it when I was taking the exam and didn’t pass because I wasn’t able to submit my working model and failed the entire exam when I passed the rest of it.

"When I try to do model.save(‘filename.h5’) for a model with text vectorizer & embedding involved, I get below error msg:
Save or restore weights that is not an instance of tf.Variable is not supported in h5, use save_format='tf' instead. Received a model or layer TextVectorization with weights

However, given that in the TF cert exam we need to upload .h5 models (i.e., tf format might not help), how do we handle this situation?"*

1 Like

The only option is to pass the data to the textvectorization function before placing the data in the model. It worked here.

Please reach out to tensorflow-certificate-team@google.com for any questions / issues related to Tensorflow Certification Exam.