今天跑了一下程序,报了如下的OOM错误
ResourceExhaustedError: OOM when allocating tensor with shape[258000,768] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
[[{{node rpn_model/rpn_conv_shared/convolution}} = Conv2D[T=DT_FLOAT, data_format="NCHW", dilations=[1, 1, 1, 1], padding="SAME", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](fpn_p2/BiasAdd, rpn_conv_shared/kernel/read)]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.
看报错主要是没内存了,按照如下思路进行纠错
默认使用第0
块GPU,该用其他GPU
$ CUDA_VISIBLE_DEVICES=1 python run_file.py
其他方法见Linux 中指定使用的GPU
注:tf日志中的使用第0块GPU 是相对可见的GPU
注哟报错中的tensor大小,可以适当的调小参数,以下有几个参数可以参考:
如果GPU 显存实在不够,可以使用CPU
$ CUDA_VISIBLE_DEVICES="" python run_file.py