TF_Serving 模型部署调用savemodel如果遇到 { “error”: “Serving signature name: ”serving_default“ not found in signature def” }
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:status = StatusCode.FAILED_PRECONDITIONdetails = "Serving signature key "serving_default" not found."debug_error_string = "{"created":"@1562657172.223509298","description":"Error received from peer ipv4:127.0.0.1:8500","file":"src/core/lib/surface/call.cc","file_line":1052,"grpc_message":"Serving signature key "serving_default" not found.","grpc_status":9}"
可以尝试以下命令,查看Serving signature name
saved_model_cli show --dir saved_model/1/ --all
# saved_model_cli show --dir savemodel模型文件夹路径/ --all
可以看出图1中的savemodel模型的Serving signature name为serving_default;
图2中的savemodel模型的Serving signature name为predict
在TF_Serving 模型部署调用时候,下面这行代码要写入对应的signature name的名字,否则会报错not found。
request.model_spec.signature_name = 'serving_default'
# request.model_spec.signature_name = 'predict'
查看秘钥具体是什么,tf默认是 serving_default
signature_def[‘helloworld’]: 中的helloworld 就是秘钥