问题描述
在为GCP上部署的ML模型设置GRPC时,我需要帮助。我已经部署了该模型,并希望使用GRPC为其提供服务,但无法找到有关如何执行该操作的任何文档。是否有人在下面提供任何信息:-
- 如何激活在ml.googleapis.com上部署的GRPC for TF服务模型?
- 使用具有授权的GRPC服务模型需要采取哪些步骤?
当前有足够的文档来处理JSON请求,但是这些请求变得非常大,我需要一种减小大小的替代方法,这就是为什么需要在其中查找更多文档的原因。现在我出错了
InactiveRpcError of RPC that terminated with:
status = StatusCode.UNKNowN
details = "Stream removed"
让我知道您是否需要更多信息。
这是我正在使用的代码
from google import auth as google_auth
from google.auth.transport import requests as google_auth_transport_requests
from google.auth.transport import grpc as google_auth_transport_grpc
from tensorflow_serving.apis import predict_pb2
def _make_grpc_request(examples):
scoped_credentials,_ = google_auth.default(scopes=('https://www.googleapis.com/auth/cloud-platform',))
request = google_auth_transport_requests.Request()
channel = google_auth_transport_grpc.secure_authorized_channel(
scoped_credentials,request,'ml.googleapis.com:443')
"""Builds and sends request to TensorFlow model server."""
request = predict_pb2.PredictRequest()
request.model_spec.name = 'nudity2'
request.model_spec.signature_name = 'serving_default'
request.inputs["input"].copyFrom(
tf.make_tensor_proto(examples))
p_s=PredictionServiceStub(channel)
response = p_s.Predict(request,1000)
response
return response
return _make_grpc_request
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)