python报错RuntimeError: Caught RuntimeError in replica 0 on device 0.

python报错:

RuntimeError: Caught RuntimeError in replica 0 on device 0.

以及

RuntimeError: CUDA out of memory. Tried to allocate 30.00 MiB (GPU 2; 15.90 GiB total capacity; 15.08 GiB already allocated; 11.69 MiB free; 15.18 GiB reserved in total by PyTorch)

往往是GPU不够用,可以把当前设置的GPU块数增加几块(如果有好几块GPU)
例如:

   parser.add_argument('--gpu_ids', type=str, default='0,5,7')

通常gpu_ids是指示gpu的编号的参数,指定你当前空闲的gpu,这里指定的是0,5,7号gpu。

你可能感兴趣的:(Python模型错误解决,python,tensorflow,pytorch)