如何解决如何在TensorFlow Servings batching_parameters.txt文件中将max_batch_size设置为无穷大
TensorFlow Serving的批处理guide建议
如果您的系统是仅cpu(无GPU)的,则考虑从以下值开始:num_batch_threads等于cpu内核数; max_batch_size到无穷大;
但是,不清楚max_batch_size的无穷大是什么。
将值设置为零或-1似乎会导致错误,因此我正在考虑将其设置为10000,以使其远远大于我可能尝试的任何值。
不过,文档中存在一些“无限”值的建议使我难以入睡。我怎么在这里表示无穷大?
解决方法
查看code source,尤其是定义protobuf消息session_bundle_config.proto
的文件BatchingParameters
,似乎不可能提供无穷大的值。
message BatchingParameters {
// SharedBatchScheduler options (see shared_batch_scheduler.h for more details
// about what each field means):
//
// The maximum size of each input batch.
//
// IMPORTANT: As discussed above,use 'max_batch_size * 2' client threads to
// achieve high throughput with batching.
google.protobuf.Int64Value max_batch_size = 1;
}
该BatchingParameters
原始消息描述了传递batching_parameters.txt
的可能选项。 model_servers/server.cc
中的以下行对其进行了解析:
if (server_options.batching_parameters_file.empty()) {
batching_parameters->mutable_thread_pool_name()->set_value(
"model_server_batch_threads");
} else {
TF_RETURN_IF_ERROR(ParseProtoTextFile<BatchingParameters>(
server_options.batching_parameters_file,batching_parameters));
}
我猜想,无穷大值的替换将是int64的最大值,所以2^63 - 1
(9 223 372 036 854 775 807
)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。