vision classification QAT tutorial: fix for DDP#2191
Merged
fmassa merged 1 commit intogh/vkuzo/1/basefrom May 11, 2020
Merged
Conversation
Summary:
Makes the classification QAT tutorial not crash when used
with DDP. There were two issues:
1. the model was moved to GPU before the observers were added, and they
are created on CPU. In the context of this repo, the fix is to finalize
the model before moving to GPU. We can potentially follow up with a
better error message in the future, in a separate PR.
2. the QAT conversion was running on the DDP'ed model, which had various
problems. The fix is to unwrap the model from DDP before cloning it for
evaluation.
There is still work to do on verifying that BN is working correctly in
QAT + DDP, but saving that for a separate PR.
Test Plan:
```
python -m torch.distributed.launch --use_env references/classification/train_quantization.py --data-path {path_to_imagenet_1k} --output_dir {output_dir}
```
Reviewers:
Subscribers:
Tasks:
Tags:
[ghstack-poisoned]
vkuzo
added a commit
that referenced
this pull request
May 7, 2020
Summary:
Makes the classification QAT tutorial not crash when used
with DDP. There were two issues:
1. the model was moved to GPU before the observers were added, and they
are created on CPU. In the context of this repo, the fix is to finalize
the model before moving to GPU. We can potentially follow up with a
better error message in the future, in a separate PR.
2. the QAT conversion was running on the DDP'ed model, which had various
problems. The fix is to unwrap the model from DDP before cloning it for
evaluation.
There is still work to do on verifying that BN is working correctly in
QAT + DDP, but saving that for a separate PR.
Test Plan:
```
python -m torch.distributed.launch --use_env references/classification/train_quantization.py --data-path {path_to_imagenet_1k} --output_dir {output_dir}
```
Reviewers:
Subscribers:
Tasks:
Tags:
ghstack-source-id: 7738a37
Pull Request resolved: #2191
Codecov Report
@@ Coverage Diff @@
## gh/vkuzo/1/base #2191 +/- ##
===============================================
Coverage 0.42% 0.42%
===============================================
Files 92 92
Lines 7448 7448
Branches 1138 1138
===============================================
Hits 32 32
Misses 7408 7408
Partials 8 8 Continue to review full report at Codecov.
|
Member
|
@vkuzo The PR you sent went to the wrong branch -- ghstack only works for the PyTorch repo. Can you send another PR targetting the master branch? |
Contributor
Author
ah, sorry about that, didn't realize ghstack doesn't work with this repo. Will do! |
vkuzo
added a commit
that referenced
this pull request
May 18, 2020
Summary: Redo of #2191 Makes the classification QAT tutorial not crash when used with DDP. There were two issues: 1. the model was moved to GPU before the observers were added, and they are created on CPU. In the context of this repo, the fix is to finalize the model before moving to GPU. We can potentially follow up with a better error message in the future, in a separate PR. 2. the QAT conversion was running on the DDP'ed model, which had various problems. The fix is to unwrap the model from DDP before cloning it for evaluation. There is still work to do on verifying that BN is working correctly in QAT + DDP, but saving that for a separate PR. Test Plan: ``` python -m torch.distributed.launch --use_env references/classification/train_quantization.py --data-path {path_to_imagenet_1k} --output_dir {output_dir} ``` Reviewers: Subscribers: Tasks: Tags:
fmassa
pushed a commit
that referenced
this pull request
May 18, 2020
Summary: Redo of #2191 Makes the classification QAT tutorial not crash when used with DDP. There were two issues: 1. the model was moved to GPU before the observers were added, and they are created on CPU. In the context of this repo, the fix is to finalize the model before moving to GPU. We can potentially follow up with a better error message in the future, in a separate PR. 2. the QAT conversion was running on the DDP'ed model, which had various problems. The fix is to unwrap the model from DDP before cloning it for evaluation. There is still work to do on verifying that BN is working correctly in QAT + DDP, but saving that for a separate PR. Test Plan: ``` python -m torch.distributed.launch --use_env references/classification/train_quantization.py --data-path {path_to_imagenet_1k} --output_dir {output_dir} ``` Reviewers: Subscribers: Tasks: Tags:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack:
Summary:
Makes the classification QAT tutorial not crash when used
with DDP. There were two issues:
are created on CPU. In the context of this repo, the fix is to finalize
the model before moving to GPU. We can potentially follow up with a
better error message in the future, in a separate PR.
problems. The fix is to unwrap the model from DDP before cloning it for
evaluation.
There is still work to do on verifying that BN is working correctly in
QAT + DDP, but saving that for a separate PR.
Test Plan:
Reviewers:
Subscribers:
Tasks:
Tags: