首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在max_batch_size服务batching_parameters.txt文件中将batching_parameters.txt设置为无穷大

如何在max_batch_size服务batching_parameters.txt文件中将batching_parameters.txt设置为无穷大
EN

Stack Overflow用户
提问于 2020-10-27 10:58:08
回答 1查看 188关注 0票数 1

分批指南用于TensorFlow服务表明,

如果您的系统是仅CPU (没有GPU),那么考虑从以下值开始: num_batch_threads等于CPU核心的数量;max_batch_size to无穷大

然而,不清楚无穷大对max_batch_size意味着什么。

将值设置为0或-1似乎会导致错误,所以我考虑将其设置为10000,以使其比我可能尝试的任何值都大得多。

尽管如此,文档中关于某些“无穷”值存在的建议给了我不安的睡眠。我怎么才能在这里表示无穷大?

EN

回答 1

Stack Overflow用户

发布于 2020-10-27 13:18:53

查看码源,特别是定义protobuf消息BatchingParameters的文件session_bundle_config.proto,似乎不可能提供无穷大的值。

代码语言:javascript
复制
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中的以下一行进行解析:

代码语言:javascript
复制
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)

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64552963

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档