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。

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐