问题
参考官方说明启动torchserve模型,然后在python client中使用GRPC APIs测试模型,提示如下错误:
io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: gRPC message exceeds maximum size 6553500: 10838210
gRPC消息超出了最大限制。
解决方法
在启动torchserve时,指定参数https://github.com/pytorch/serve/blob/master/docs/configuration.md#command-line-parameters
加上--ts-config参数,在传入的配置文件中,修改gRPC允许的最大size。
inference_address=http://0.0.0.0:8080
management_address=http://0.0.0.0:8081
metrics_address=http://0.0.0.0:8082
number_of_netty_threads=32
job_queue_size=1000
model_store=/home/model-server/model-store
workflow_store=/home/model-server/wf-store
max_request_size=65535000
就是其中的max_request_size=65535000,可以从错误提示中看到,默认大小是6553500,我这里直接设置成原来的10倍了,可以根据自己需要进行设置。