簡體   English   中英

如何修改TensorFlow代碼以接受樣本以在Google Cloud ML上進行預測?

[英]How to modify TensorFlow code to accept samples for prediction on Google Cloud ML?

從Cloud Storage導出訓練有素的模型后,我嘗試在Google Cloud ML上創建模型,但出現的錯誤是:

Create Version failed. Model validation failed: SavedModel must contain exactly one metagraph with tag: serve For more information on how to export Tensorflow SavedModel, seehttps://www.tensorflow.org/api_docs/python/tf/saved_model.

所以我的訓練中只有一個TensorFlow .add_meta_graph_and_variables() 我是否應該再安排一個人來處理新的輸入? 我不完全了解創建服務元圖的過程以及如何設置代碼以評估單個實例。

是的,如果您正在使用核心TensorFlow,則應導出單獨的預測圖。 看到:

https://github.com/GoogleCloudPlatform/cloudml-samples/blob/master/census/tensorflowcore/trainer/model.py

如果您使用的是Estimator API,則只需使用Experiment並傳入導出函數。 我強烈建議使用Estimator / Experiment而不是核心TensorFlow

https://github.com/GoogleCloudPlatform/cloudml-samples/blob/master/census/estimator/trainer/task.py#L43

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM