Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vision classification QAT tutorial: fix for DDP (redo) #2230

Merged
merged 1 commit into from
May 18, 2020

Conversation

vkuzo
Copy link
Contributor

@vkuzo vkuzo commented 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:

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:
@vkuzo vkuzo requested review from fmassa and raghuramank100 May 18, 2020 16:43
Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@fmassa fmassa merged commit 7ed3950 into master May 18, 2020
@fmassa fmassa deleted the qat_dpp_tutorial2 branch May 18, 2020 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants