【发布时间】: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