我正在尝试使用MultiInference方法在一个请求(A / B测试)中检查某个模型的两个不同版本。但是在某些情况下,我遇到了错误Duplicate evaluation of signature: classification
,在另一种情况下,我得到了非常奇怪的结果。
示例:
Input request:
tasks {
model_spec {
name: "stpeter"
version {
value: 7
}
signature_name: "classification"
}
method_name: "tensorflow/serving/classify"
}
tasks {
model_spec {
name: "stpeter"
version {
value: 8
}
signature_name: "classification"
}
method_name: "tensorflow/serving/classify"
}
input {
example_list {
examples {
features {
feature {
key: "inputs"
value {
bytes_list {
value: "ala.kowalska"
}
}
}
}
}
}
}
Traceback (most recent call last):
File "ab_test.py", line 146, in <module>
do_inference(args)
File "ab_test.py", line 123, in do_inference
results = stub.MultiInference(request, 10)
File "/anaconda3/envs/ents/lib/python3.6/site-packages/grpc/_channel.py", line 533, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "/anaconda3/envs/ents/lib/python3.6/site-packages/grpc/_channel.py", line 467, in _end_unary_response_blocking
raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
status = StatusCode.INVALID_ARGUMENT
details = "Duplicate evaluation of signature: classification"
debug_error_string = "{"created":"@1549359403.703597000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"Duplicate evaluation of signature: classification","grpc_status":3}"
>
signature_name
之一。Input request:
tasks {
model_spec {
name: "stpeter"
version {
value: 7
}
signature_name: "classification"
}
method_name: "tensorflow/serving/classify"
}
tasks {
model_spec {
name: "stpeter"
version {
value: 8
}
}
method_name: "tensorflow/serving/classify"
}
input {
example_list {
examples {
features {
feature {
key: "inputs"
value {
bytes_list {
value: "ala.kowalska"
}
}
}
}
}
}
}
Results:
results {
model_spec {
name: "stpeter"
version {
value: 7
}
signature_name: "classification"
}
classification_result {
classifications {
classes {
label: "BOT"
score: 0.010155047290027142
}
classes {
label: "HUMAN"
score: 0.9898449182510376
}
}
}
}
results {
model_spec {
name: "stpeter"
version {
value: 7
}
signature_name: "serving_default"
}
classification_result {
classifications {
classes {
label: "BOT"
score: 0.010155047290027142
}
classes {
label: "HUMAN"
score: 0.9898449182510376
}
}
}
}
它似乎运行良好(没有错误)。但是,让我们仔细看看结果。尽管任务#2定义了version {value: 8}
,我们仍可以从版本7的stpeter中找到这两个任务的答案(signature_name =“ classification”和signature_name =“ serving_default”)。
使用Tensorflow估算器创建服务模型,并使用export_savedmodel
保存。因为我们有可用的签名:
INFO:tensorflow:Signatures INCLUDED in export for Classify: ['serving_default', 'classification']
INFO:tensorflow:Signatures INCLUDED in export for Regress: ['regression']
INFO:tensorflow:Signatures INCLUDED in export for Predict: ['predict']
inference.proto中的型号版本没有限制。
我也检查了TFS test cases,但似乎我的案子没有得到检查。
如果只提供一个小技巧可以帮助我解决这个问题,我将不胜感激。