SavedModel doesn't contain MetaGraphDef for tag 'serve'

I’m getting the following error when running my source code:

RuntimeError: MetaGraphDef associated with tags 'serve' could not be found in SavedModel. To inspect available tag-sets in the SavedModel, use the SavedModel CLI: `saved_model_cli`

When I run saved_model_cli show --dir ./, I get the following output:

MetaGraphDef with tag-set: 'train, serve' contains the following SignatureDefs:

I’ve seen solutions suggesting I use [tf.saved_model.tag_constants.SERVING], but I haven’t been able to solve the issue.

Solution
I’m getting the following error when running my source code:

RuntimeError: MetaGraphDef associated with tags 'serve' could not be found in SavedModel.

When I run saved_model_cli show --dir ./, I get the following output:

MetaGraphDef with tag-set: 'train, serve' contains the following SignatureDefs:

I’ve seen solutions suggesting I use [tf.saved_model.tag_constants.SERVING], but I haven’t been able to solve the issue.

The error indicates that the serve tag is not found in the SavedModel. You can try specifying the SERVING tag using tf.saved_model.tag_constants.SERVING when loading the model. For example:

loaded_model = tf.saved_model.load(model_path, tags=[tf.saved_model.tag_constants.SERVING])

This should load the SavedModel with the serve tag.