【问题标题】:TF-Slim: (Unreasonable?) running out of memoryTF-Slim:(不合理?)内存不足
【发布时间】:2017-03-02 20:22:45
【问题描述】:

我正在尝试运行 TF SLIM 中的教程之一,您可以使用 Inception-V3 (~104Mb) 微调花数据集。 GPU 有大约 2Gb 的内存。当我的批量大小超过 8 时,我会收到一个错误,因为 GPU 内存不足。事实上,我似乎收到了几条消息,每条看起来像:

W tensorflow/core/common_runtime/bfc_allocator.cc:217] Ran out of memory trying to allocate 646.50MiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory is available.

W tensorflow/core/common_runtime/bfc_allocator.cc:274]     **************************************x*************************************************************
W tensorflow/core/common_runtime/bfc_allocator.cc:275] Ran out of memory trying to allocate 168.8KiB.  See logs for memory state.

现在,很可能是我的 GPU 没有足够大的 RAM。但是,2GB 似乎足以加载 ~100Mb 模型。此外,使用 Caffe,我可以毫无问题地微调 Alexnet (~400Mb)。此外,我还尝试使用

来允许 GPU 增长(据我了解,使用系统的 RAM)
session_config = tf.ConfigProto(allow_soft_placement=True)
session_config.gpu_options.allow_growth = True
session_config.gpu_options.allocator_type = 'BFC'"

但它似乎没有帮助。

你知道吗

a) 我做错了什么 b) GPU 不够大 c) TF Slim 通过构建消耗太多内存

?

谢谢,

【问题讨论】:

  • 现在我在想,可能是层激活占用了内存(与 Alexnet 不同,层数更多)。不过,如果有人能验证这一点,那就太好了。

标签: tensorflow tf-slim


【解决方案1】:

是否有其他进程正在使用足够的 GPU 内存而没有多少剩余用于 tensorflow?我相信nvidia-smi 会告诉您已经使用了多少 GPU 内存。

如果不是这种情况,您可能需要查看分配以了解发生了什么。见this other question on how to log allocations from tensorflow

【讨论】:

  • 嗯,谢谢你的想法。我想我可以尝试杀死 X 服务器,尽管我很难相信桌面占用了如此多的 GPU 内存。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-10-15
  • 1970-01-01
  • 2017-10-28
  • 2017-10-11
  • 2014-05-18
  • 2020-06-09
相关资源
最近更新 更多