Ludong418 / BERT-NER-TENSOR-SERVING

基于Bert(或Robert)预训练模型微调命名实体识别任务,并提供基于docker的Tensor Serving部署模型方案实现过程。
36 stars 7 forks source link

您好根据您的代码,我在同一台服务器,去连接tensorflow-serving服务。报 status = StatusCode.INVALID_ARGUMENT details = "input size does not match signature: 1!=5 len({examples}) != len({input_ids,input_mask,label_ids,mask,segment_ids}). Sent extra: {examples}. Missing but required: {input_ids,input_mask,label_ids,mask,segment_ids}." #1

Open SevenMpp opened 3 years ago

SevenMpp commented 3 years ago
raise _InactiveRpcError(state)

grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with: status = StatusCode.INVALID_ARGUMENT details = "input size does not match signature: 1!=5 len({examples}) != len({input_ids,input_mask,label_ids,mask,segment_ids}). Sent extra: {examples}. Missing but required: {input_ids,input_mask,label_ids,mask,segment_ids}." debug_error_string = "{"created":"@1613808415.914870456","description":"Error received from peer ipv4:10.10.137.227:8500","file":"src/core/lib/surface/call.cc","file_line":1067,"grpc_message":"input size does not match signature: 1!=5 len({examples}) != len({input_ids,input_mask,label_ids,mask,segment_ids}). Sent extra: {examples}. Missing but required: {input_ids,input_mask,label_ids,mask,segment_ids}.","grpc_status":3}"

Ludong418 commented 3 years ago
raise _InactiveRpcError(state)

grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with: status = StatusCode.INVALID_ARGUMENT details = "input size does not match signature: 1!=5 len({examples}) != len({input_ids,input_mask,label_ids,mask,segment_ids}). Sent extra: {examples}. Missing but required: {input_ids,input_mask,label_ids,mask,segment_ids}." debug_error_string = "{"created":"@1613808415.914870456","description":"Error received from peer ipv4:10.10.137.227:8500","file":"src/core/lib/surface/call.cc","file_line":1067,"grpc_message":"input size does not match signature: 1!=5 len({examples}) != len({input_ids,input_mask,label_ids,mask,segment_ids}). Sent extra: {examples}. Missing but required: {input_ids,input_mask,label_ids,mask,segment_ids}.","grpc_status":3}"

我提供两种可能和解决方法吧,具体我也不确定。

  1. 先测试你的tensor serving模型服务是否通, 不通的话需要关闭防火墙,用下面命令测试: telnet 10.10.137.227 8500
  2. 你启动docke时候,使用以下命令(这个是进入容器在终端运行的): tensorflow_model_server --name=modelserving --port=8500 --rest_api_port=8501 --model_name=<模型的名称> --model_base_path=<模型存储的位置,不指定版本> 当你预测的时候,使用infer.py 文件时候 nerinfer = NerInfer(vocab_file, labels, url='10.0.10.69:8500', model_name=<模型的名称>, signature_name='serving_default') 要保证两个的 model_name 是一样的。