grpc._channel._InactiveRpcError: _InactiveRpcError of RPC that terminated with: status = StatusCode.INTERNAL

grpc._channel._InactiveRpcError: _InactiveRpcError of RPC that terminated with: status = StatusCode.INTERNAL

这是一个 gRPC 服务和客户端 python 程序。 运行 客户端脚本抛出此错误后。我对使用 API/gRPC 特别陌生。如果我知道可能是什么问题,那就太好了。安装了 gRPC 库和一些支持库。

即使服务器 运行 正确,通过 gRPC 的通信也会以内部错误状态代码终止。 运行 它在本地主机上。

return _end_unary_response_blocking(state, call, False, None)
  File "/home/mark/anaconda3/envs/custom-model-server/lib/python3.8/site-packages/grpc/_channel.py", line 849, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.INTERNAL
        details = "indices[0,350] = 1650751580 is not in [0, 30522)
         [[{{node tf_bert_for_sequence_classification/bert/embeddings/Gather}}]]"
        debug_error_string = "{"created":"@1629922773.170809502","description":"Error received from peer ipv4:127.0.0.1:8001","file":"src/core/lib/surface/call.cc","file_line":1066,"grpc_message":"indices[0,350] = 1650751580 is not in [0, 30522)\n\t [[{{node tf_bert_for_sequence_classification/bert/embeddings/Gather}}]]","grpc_status":13}"
'''

这个问题的解决方案是检查传递给函数的字节数组,并确保我们获取的长度是数组本身的长度,而不是以字节为单位。所以我们能够做到:

dimensions = len(byte_array)//4