且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 OSX 上使用 Docker 的 Tensorflow 服务编译错误

更新时间:2023-12-02 18:49:40

已解决!看起来问题在于 VM 中的内存不足.

Solved! Looks like the issues was with running out of memory in the VM.

这是我修复它的方法:

1) 创建机器时,确保它有更多内存(我的只有 1GB).以下是创建 4GB docker 机器的方法:

1) When creating the machine, make sure it has more memory (mine was only 1GB). Here is how you create a docker machine with 4GB:

docker-machine create -d virtualbox --virtualbox-memory 4096 default

2) 运行 bazel 命令时,传入一个限制要使用的内存量的参数.在这里,我仅使用 2GB 运行命令:

2) When running the bazel command pass in a parameter limiting the amount of memory to use. Here I'm running the command using only 2GB:

bazel build -c opt --copt=-mavx --verbose_failures --local_resources 2048,2.0,1.0 -j 1 //tensorflow_serving/example:mnist_export 

原始命令在哪里:

bazel build //tensorflow_serving/example:mnist_export