Comments (2)
Owner
是这样的,我试了一下。每个GPU只能看到所有数据的一部分,是我的计算方法有误,应该除以每个GPU看到的所有样本数量,而不是数据集所有的样本数量。
谢谢作者的解答
from pytorch-multi-gpu-training.
我理解原因可能是:
ddp是数据并行,意味着模型有多份,它们有些相同的初始参数,每次前向后向时只看到属于自己partition的训练数据,算完梯度后,进程间通讯,大家同步一下参数。我看你是直接算当前batch上的准确率,并且是在backward之前,那意味着还没同步参数,模型看到的训练数据是不一样的:如果是1GPU,那模型是看到全量数据的,如果是2GPU,每个模型只看到了一半的数据,导致算出来的准确率也不一样。
建议在完成一个前向后向后,在测试集上计算指标。
from pytorch-multi-gpu-training.
Related Issues (5)
- ddp_train.py 里没有固定随机种子操作 HOT 1
- 指出一点改进 HOT 1
- 项目 HOT 1
- 报错 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch-multi-gpu-training.