api - grpc._channel._InactiveRpcError: _InactiveRpcError 的 RPC 终止于:status = StatusCode.INTERNAL
问题描述
这是一个 gRPC 服务和客户端 python 程序。运行客户端脚本后,它会抛出此错误。特别是我对使用 API/gRPC 很陌生。如果我知道可能是什么问题,那就太好了。安装了 gRPC 库和一些支持库。
即使服务器运行正常,通过 gRPC 的通信也会以 INTERNAL 错误状态代码终止。在本地主机上运行它。
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
推荐阅读
- sql - 更新最新数据
- javascript - Vue 事件监听器中的 if - else 语句
- python - 如何从python中的字符串中提取包含逗号的数字
- django - 从 Django 间隔中提取小时和秒
- reactjs - 导航栏中的搜索栏使用 react-bulma-components 不呈现
- python - 通过高级索引/矢量化更新矩阵
- java - 如何在 selenium webdriver 中单击 svg 元素
- python - 我的 Tkinter 文件在 3 次尝试后无法打开。请帮助我
- python - 芹菜任务的正确类型注释
- javascript - 如何在 hbs 中使用 #each 迭代数组?