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

[Feature] Support mmcls with NPU backend. #1072

Merged
merged 2 commits into from
Oct 24, 2022

Conversation

wangjiangben-hw
Copy link

@wangjiangben-hw wangjiangben-hw commented Oct 5, 2022

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

Added ascending device support in mmcv.

Modification

  • The main modification points are as follows:
    1. In mmcls/apis/train.py, We added an NPU device in the DDP scenario, and the mixing accuracy is enabled by default when using the NPU
    2. In ``mmcls/utils/distribution.py```, We have added DP and DDP classes for NPU
    3. In ``mmcls/datasets/samplers/distributed_sampler.py```, We added device judgment to make the broadcast within the sync_random_seed function execute correctly on the npu

BC-breaking (Optional)

A new mmcv containing the NPU background needed.

Use cases (Optional)

We tested resnet50_8xb32_in1k.py with Top-1 (%): 76.4

Checklist

Before PR:

  • Pre-commit or other linting tools are used to fix the potential lint issues.
  • Bug fixes are fully covered by unit tests, the case that causes the bug should be added in the unit tests.
  • The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  • The documentation has been modified accordingly, like docstring or example tutorials.

After PR:

  • If the modification has potential influence on downstream or other related projects, this PR should be tested with those projects, like MMDet or MMSeg.
  • CLA has been signed and all committers have signed the CLA in this PR.

@CLAassistant
Copy link

CLAassistant commented Oct 5, 2022

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Oct 8, 2022

Codecov Report

Base: 86.09% // Head: 85.98% // Decreases project coverage by -0.11% ⚠️

Coverage data is based on head (905ea52) compared to base (517bd3d).
Patch coverage: 13.33% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1072      +/-   ##
==========================================
- Coverage   86.09%   85.98%   -0.12%     
==========================================
  Files         140      142       +2     
  Lines        9676     9906     +230     
  Branches     1677     1715      +38     
==========================================
+ Hits         8331     8518     +187     
- Misses       1092     1124      +32     
- Partials      253      264      +11     
Flag Coverage Δ
unittests 85.93% <13.33%> (-0.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmcls/apis/train.py 15.00% <0.00%> (-0.39%) ⬇️
mmcls/utils/distribution.py 7.40% <0.00%> (-3.12%) ⬇️
mmcls/datasets/samplers/distributed_sampler.py 85.71% <100.00%> (+0.52%) ⬆️
mmcls/models/backbones/repvgg.py 96.15% <0.00%> (-0.69%) ⬇️
mmcls/apis/test.py 23.27% <0.00%> (-0.66%) ⬇️
mmcls/models/backbones/van.py 96.83% <0.00%> (ø)
mmcls/models/utils/__init__.py 100.00% <0.00%> (ø)
mmcls/models/utils/attention.py 96.91% <0.00%> (ø)
mmcls/models/backbones/__init__.py 100.00% <0.00%> (ø)
... and 5 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@mzr1996 mzr1996 left a comment

Choose a reason for hiding this comment

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

To be compatible with the old version of MMCV, please avoid importing new API from MMCV.

mmcls/apis/train.py Outdated Show resolved Hide resolved
mmcls/apis/train.py Outdated Show resolved Hide resolved
mmcls/datasets/samplers/distributed_sampler.py Outdated Show resolved Hide resolved
mmcls/datasets/samplers/distributed_sampler.py Outdated Show resolved Hide resolved
@mzr1996 mzr1996 changed the base branch from master to dev October 24, 2022 03:44
@mzr1996 mzr1996 merged commit 17ed870 into open-mmlab:dev Oct 24, 2022
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.

None yet

3 participants