我想使用TensorFlow服務於自定義模型(無預先訓練的起點)。TensorFlow服務於自定義模型
我已經通過了成立以來TensorFlow服務教程的預Kubernetes部分做到了,用多克:http://tensorflow.github.io/serving/serving_inception
我明白了(大致)的巴澤爾編譯的核心是如何一切正常。但我想了解如何從tensorflow_serving.apis
生成predict_pb2
的作品,以便我可以在我自己的自定義模型中交換。
需要明確的是,這是在inception_client.py
的main
目前的樣子:
def main(_):
host, port = FLAGS.server.split(':')
channel = implementations.insecure_channel(host, int(port))
stub = prediction_service_pb2.beta_create_PredictionService_stub(channel)
# Send request
with open(FLAGS.image, 'rb') as f:
# See prediction_service.proto for gRPC request/response details.
data = f.read()
request = predict_pb2.PredictRequest()
request.model_spec.name = 'inception'
request.model_spec.signature_name = 'predict_images'
request.inputs['images'].CopyFrom(
tf.contrib.util.make_tensor_proto(data, shape=[1]))
result = stub.Predict(request, 10.0) # 10 secs timeout
print(result)
這是我很難解包和調試什麼predict_pb2.PredictRequest()
做,因爲它是巴澤爾產生。但我想重新指出一個完全不同的,保存的模型,其自己的.pb文件等。
我該如何引用不同的保存模型?