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

[Enhance] Adapt test cases on Ascend NPU. #1728

Merged
merged 1 commit into from
Jul 28, 2023

Conversation

Ginray
Copy link
Contributor

@Ginray Ginray commented Jul 27, 2023

Motivation

The current test case is only compatible with cpu and cuda devices, and an error will be reported when testing on the Ascend NPU.
AssertionError: The values for attribute 'device' do not match: npu:0 != cpu.

Modification

Replace the original 'torch.cuda.is_available()' function with the 'get_device' function.

BC-breaking (Optional)

Does not affect.

Use cases (Optional)

We have passed all 637 test cases of mmpretrain on Ascend npu.

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.

@codecov
Copy link

codecov bot commented Jul 27, 2023

Codecov Report

Patch coverage: 57.48% and project coverage change: -19.70% ⚠️

Comparison is base (89eaa92) 85.22% compared to head (ef432b3) 65.52%.
Report is 85 commits behind head on main.

❗ Current head ef432b3 differs from pull request most recent head 5a17227. Consider uploading reports for the commit 5a17227 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1728       +/-   ##
===========================================
- Coverage   85.22%   65.52%   -19.70%     
===========================================
  Files         229      330      +101     
  Lines       17243    25671     +8428     
  Branches     2707     4088     +1381     
===========================================
+ Hits        14696    16822     +2126     
- Misses       2046     8233     +6187     
- Partials      501      616      +115     
Flag Coverage Δ
unittests 65.52% <57.48%> (-19.70%) ⬇️

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

Files Changed Coverage Δ
mmpretrain/apis/image_retrieval.py 21.42% <19.04%> (+0.88%) ⬆️
mmpretrain/apis/image_caption.py 30.64% <30.64%> (ø)
mmpretrain/apis/feature_extractor.py 37.50% <40.00%> (+0.18%) ⬆️
mmpretrain/apis/model.py 75.65% <65.90%> (-4.02%) ⬇️
mmpretrain/apis/base.py 72.44% <72.44%> (ø)
mmpretrain/__init__.py 100.00% <100.00%> (ø)
mmpretrain/apis/__init__.py 100.00% <100.00%> (ø)
mmpretrain/apis/image_classification.py 86.48% <100.00%> (+0.93%) ⬆️

... and 149 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mzr1996 mzr1996 merged commit c5248b1 into open-mmlab:main Jul 28, 2023
5 of 6 checks passed
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.

3 participants