使用DistributedDataParallel进行单机多GPU训练,官方教程很详细了。
最后需要通过CUDA_VISIBLE_DEVICES=0,1,2,3 python -m torch.distributed.launch --nproc_per_node=2 train.py调用。
import torch
import torch.distributed as dist
torch.distributed.init_process_group(backend="nccl")
local_rank = torch.distributed.get_rank(

最低0.47元/天 解锁文章
2856

被折叠的 条评论
为什么被折叠?



