What is the SageMaker TensorFlow SavedModel export format?

你离开我真会死。 提交于 2020-01-15 09:35:09

问题


I'm new to AWS SageMaker TensorFlow 1.11.0 script mode. Been looking around the documentation for a while and can't seem to find the folder structure to export the model in after training. All I know is that I'm suppose to export to the directory specified in the env variable "SM_MODEL_DIR" and that the format is SavedModel.

I've used tf.saved_model.simple_save to export in the following folder structure:

- model.tar.gz
-- saved_model.pb
-- variables
--- variables.index
--- variables.data-00000-of-00001

But upon deploying, I get the error:

Traceback (most recent call last):
File "/sagemaker/serve.py", line 189, in <module>
ServiceManager().start()
File "/sagemaker/serve.py", line 163, in start
self._create_tfs_config()
File "/sagemaker/serve.py", line 53, in _create_tfs_config
raise ValueError('no SavedModel bundles found!')

any help would be nice. Thx


回答1:


You are seeing this error because TensorFlow Serving (which SageMaker uses to host your model) requires the SavedModel to be nested in a version subdirectory.

Add a version directory your model archive to this structure to make it work. Example:

- model.tar.gz
-- 1
--- saved_model.pb
--- variables
---- variables.index
---- variables.data-00000-of-00001

See the Load and serve a SavedModel in TensorFlow serving section of the TensorFlow Save and Restore Guide for more info.



来源:https://stackoverflow.com/questions/53879540/what-is-the-sagemaker-tensorflow-savedmodel-export-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!