@@ -87,6 +87,8 @@ namespace triton { namespace backend { namespace python {
8787 } \
8888 } while (false )
8989
90+ constexpr int MAX_GRPC_MESSAGE_SIZE = INT32_MAX ;
91+
9092class ModelState ;
9193
9294struct BackendState {
@@ -261,8 +263,11 @@ TRITONSERVER_Error*
261263ModelInstanceState::ConnectPythonInterpreter ()
262264{
263265 grpc_init ();
264- auto grpc_channel =
265- grpc::CreateChannel (domain_socket_, grpc::InsecureChannelCredentials ());
266+ grpc::ChannelArguments arguments;
267+ arguments.SetMaxSendMessageSize (MAX_GRPC_MESSAGE_SIZE );
268+ arguments.SetMaxReceiveMessageSize (MAX_GRPC_MESSAGE_SIZE );
269+ auto grpc_channel = grpc::CreateCustomChannel (
270+ domain_socket_, grpc::InsecureChannelCredentials (), arguments);
266271
267272 stub = PythonInterpreter::NewStub (grpc_channel);
268273
@@ -441,6 +446,12 @@ ModelInstanceState::GetInputTensor(
441446 in, &input_name, &input_dtype, &input_shape, &input_dims_count,
442447 &input_byte_size, &input_buffer_count));
443448
449+ if (input_byte_size >= MAX_GRPC_MESSAGE_SIZE )
450+ return TRITONSERVER_ErrorNew (
451+ TRITONSERVER_ERROR_UNSUPPORTED ,
452+ " Python backend does not support input size larger than 2GBs, consider "
453+ " parititioning your input into multiple inputs." );
454+
444455 // Update input_tensor
445456 input_tensor->set_name (input_name);
446457 input_tensor->set_dtype (static_cast <int >(input_dtype));
0 commit comments