How to convert tf.estimator.DNNClassifier() to tflite

code:

classifier1 = tf.estimator.DNNClassifier(
feature_columns=my_feature_columns,
hidden_units=[128,64,32,10],
n_classes=10)

#Save model

feature_spec = tf.feature_column.make_parse_example_spec(my_feature_columns)
export_input_fn = tf.estimator.export.build_parsing_serving_input_receiver_fn(feature_spec)
servable_model_dir = “/content/DNN_model”
servable_model_path = classifier1.export_saved_model(servable_model_dir, export_input_fn)

#convert to tflite
converter = tf.lite.TFLiteConverter.from_saved_model("/content/DNN_model/1653290705/saved_model.pb")
tflite_model = converter.convert()

#finaly get this error
OSError: SavedModel file does not exist at: /content/DNN_model/1653290705/saved_model.pb/{saved_model.pbtxt|saved_model.pb}

How can fix this error? [note this code create on colab]

You need to specify the directory that has the saved model, not the .pb file in the saved model directory.
So if you saved the mdoel in “/content/DNN_model” then pass the same path “/content/DNN_model” to the converter.

converter=tf.lite.TFLiteConverter.from_saved_model(servable_model_dir)