![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
torch分布式
CV/NLP大虾
https://github.com/hanhui269/
展开
-
pytorch分布式训练(一)
torch.utils.data.DataLoader()样例:""" 批训练,把数据变成一小批一小批数据进行训练。 DataLoader就是用来包装所使用的数据,每次抛出一批数据"""import torchimport torch.utils.data as DataBATCH_SIZE = 5x = torch.linspace(1, 10, 10)y = torch.linspace(10, 1, 10)# 把数据放在数据库中torch_dataset = D.原创 2020-07-06 18:17:46 · 2917 阅读 · 6 评论 -
pytorch分布式训练(三DistributedDataParallel)
DistributedDataParallelDistributedDataParallel为pytorch分布式接口:model = torch.nn.parallel.DistributedDataParallel( model, device_ids=[args.local_rank], output_device=args.local_rank, # this should be removed if we update BatchNorm stats原创 2020-07-09 15:30:18 · 2244 阅读 · 0 评论 -
pytorch分布式训练(二init_process_group)
backend str/Backend 是通信所用的后端,可以是"ncll" "gloo"或者是一个torch.distributed.Backend类(Backend.GLOO)init_method str 这个URL指定了如何初始化互相通信的进程world_size int 执行训练的所有的进程数rank int this进程的编号,也是其优先级timeout timedelta 每个进程执行的超时时间,默认是30分钟,这个参数只适用于gloo后端group_name str 进程所在gr.原创 2020-07-09 11:49:21 · 32581 阅读 · 7 评论 -
pytorch分布式训练(五DataLoader)
torch.utils.data.DataLoader本节讲述collate_fn使用。 def __init__(self, dataset, batch_size=1, shuffle=False, sampler=None, batch_sampler=None, num_workers=0, collate_fn=None, pin_memory=False, drop_last=False, timeout=0,原创 2020-07-09 10:51:33 · 792 阅读 · 0 评论