【发布时间】:2018-01-15 06:16:49
【问题描述】:
我在尝试为 Nvidia K80 上的 CNN 模型增加 batch_size 时遇到以下错误:
2017-08-07 20:33:38.573318: W tensorflow/core/common_runtime/bfc_allocator.cc:217] Allocator (GPU_0_bfc) ran out of memory trying to allocate 3.04GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory is available.
我想知道遇到这种情况时最快的选择是什么:
- 什么都不做,让模型不顾警告训练。
- 将批大小和学习率按一个因子缩小,但以相同的因子进行更多迭代,以便以较小的批大小和更多的迭代得到相同的结果(遵循 线性缩放规则 如this paper 中所述)。
【问题讨论】:
-
由于增加批量大小而导致的训练效率始终是亚线性的(即,2 倍大的批量大小需要超过 0.5 倍的迭代)。因此,如果增加批量大小不会导致吞吐量的超线性增加,那就是净损失。所以要做的是看看你的吞吐量是如何受到影响的,即一旦你的训练吞吐量开始下降,就停止增加批量大小
标签: python performance tensorflow gpu tensorflow-gpu