首页
常用链接
关于
Search
1
Pytorch DDP
2,093 阅读
2
Pytorch 常见问题
1,210 阅读
3
视频时序切分
854 阅读
4
Semi-Supervised + Noisy Label
747 阅读
5
中文场景下的CLIP图文预训练
738 阅读
阅读
论文阅读
多模态理解
计算机视觉
Video Understanding
Segmentation
AIGC
机器学习
编程开发
C++
Python
LeetCode
Shell
Pytorch
模型加速
广告
广告基础知识
推荐算法
创意优选
购房/投资
职场经验复盘
默认分类
Search
标签搜索
python
Pandas
transformer
视觉传统方法
创意质量
git
shell
视频理解
Pytroch
nlp
DDP
图像自监督预训练
安装包
视频流行度
Jefxiong
累计撰写
50
篇文章
累计收到
7
条评论
首页
栏目
阅读
论文阅读
多模态理解
计算机视觉
Video Understanding
Segmentation
AIGC
机器学习
编程开发
C++
Python
LeetCode
Shell
Pytorch
模型加速
广告
广告基础知识
推荐算法
创意优选
购房/投资
职场经验复盘
默认分类
页面
常用链接
关于
搜索到
1
篇与
DDP
的结果
2022-02-19
Pytorch DDP
1. Pytorch DDP 使用大致流程 使用 torch.distributed.init_process_group 初始化进程组 使用 torch.nn.parallel.DistributedDataParallel 创建 分布式模型 使用 torch.utils.data.distributed.DistributedSampler 创建 DataLoader 2. Pytorch DDP 训练报错信息 [W reducer.cpp:346] Warning: Grad strides do not match bucket view strides. This may indicate grad was not created according to the gradient layout contract, or that the param's strides changed since DDP was constructed. This is not an error, but may impair performance. Expected to mark a variable ready only once. RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one. 3. DDP多卡训练需要主要事项? 为每个进程设置不同的随机种子 使用syncBN DistributedSampler 多进程的日志管理,文件创建管理,目录创建管理等 4. DDP 单机多卡卡住问题(hang/stuck/dead lock) 现象: GPU利用率100%,但是程序一直没有输出。 (1) 限制单进程并发数(无效) torch.set_num_threads(4) (2) 设置find_unused_parameters为True model = torch.nn.parallel.DistributedDataParallel(model, device_ids=[int(args.local_rank)], output_device=int(args.local_rank), find_unused_parameters=True) # find_unused_parameters 的含义: 查找未用于计算损失的参数 (3) 排查NCCL问题? # 设置环境变量,看是否有更多的信息输出,更多环境变量参考 # https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/env.html export NCCL_DEBUG=INFO export NCCL_DEBUG_SUBSYS=ALL (4) 在不同GPU上,部分分支的输出结果未参与损失计算 报错信息: RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one. 由于过滤了样本,只有当样本满足一定条件下才计算损失(比如回归任务中,只有当pred与gt在一定范围内才计算损失),会导致不同GPU上,缺少梯度计算,导致导致程序假死 参考文献 Pytorch官方文档 Pytorch官方教程 Pytorch多gpu并行训练教程 DDP系列第一篇:入门教程 DDP系列第二篇:实现原理与源代码解析 DDP系列第三篇:实战与技巧 pytorch 多机多卡卡住问题汇总 PyTorch 源码解读之 DP & DDP:模型并行和分布式训练解析 https://discuss.pytorch.org/t/distributed-data-parallel-freezes-without-error-message/8009
2022年02月19日
2,093 阅读
1 评论
3 点赞
粤ICP备2021042327号