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 CPU training #7016

Merged
merged 4 commits into from
Jan 19, 2022
Merged

[Feature] Support CPU training #7016

merged 4 commits into from
Jan 19, 2022

Conversation

AronLin
Copy link
Contributor

@AronLin AronLin commented Jan 17, 2022

We support CPU training.

The model is default put on cuda device, we modify this setting so that if there are no cuda devices, the model will be put on cpu.
This PR is based on open-mmlab/mmcv#1621, we should merge this PR after 1621.

Now we can use the CPU to train/debug our model and test our model with batch size >=2. Before running the program we need to export CUDA_VISIBLE_DEVICES=-1 to disable GPU visibility.

@codecov
Copy link

codecov bot commented Jan 17, 2022

Codecov Report

Merging #7016 (a7d7a1d) into dev (ff9bc39) will increase coverage by 0.03%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #7016      +/-   ##
==========================================
+ Coverage   62.35%   62.39%   +0.03%     
==========================================
  Files         327      329       +2     
  Lines       26129    26176      +47     
  Branches     4424     4432       +8     
==========================================
+ Hits        16293    16332      +39     
- Misses       8969     8975       +6     
- Partials      867      869       +2     
Flag Coverage Δ
unittests 62.37% <0.00%> (+0.03%) ⬆️

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

Impacted Files Coverage Δ
mmdet/apis/train.py 15.66% <0.00%> (ø)
mmdet/datasets/pipelines/formating.py 0.00% <0.00%> (-67.77%) ⬇️
mmdet/core/bbox/samplers/random_sampler.py 75.00% <0.00%> (-5.56%) ⬇️
mmdet/core/visualization/image.py 79.20% <0.00%> (-0.80%) ⬇️
mmdet/apis/test.py 13.39% <0.00%> (-0.13%) ⬇️
mmdet/apis/inference.py 38.53% <0.00%> (ø)
mmdet/datasets/deepfashion.py 100.00% <0.00%> (ø)
mmdet/core/visualization/__init__.py 100.00% <0.00%> (ø)
mmdet/datasets/pipelines/formatting.py 67.76% <0.00%> (ø)
mmdet/core/visualization/palette.py 93.75% <0.00%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ff9bc39...a7d7a1d. Read the comment docs.

tools/train.py Outdated Show resolved Hide resolved
tools/test.py Outdated Show resolved Hide resolved
@AronLin
Copy link
Contributor Author

AronLin commented Jan 17, 2022

The bug about non-distributed multi-GPU training is removed to #7019

Comment on lines +553 to +555
**Note**:

We do not recommend users to use CPU for training because it is too slow. We support this feature to allow users to debug on machines without GPU for convenience.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should have used the "note" wrapper

```{note}
```

@EasonQYS
Copy link

[question] If I want to use mmdet/apis/train.py , how to understand "device_ids=cfg.gpu_ids"?
What should be equel to cfg.gpu_ids?
As I know, cfg.gpu_ids should be a non-negtive sequence like [0,] or [0,1,]. but not accept [-1,] or -1.

@AronLin AronLin deleted the cpu branch February 14, 2022 21:29
chhluo pushed a commit to chhluo/mmdetection that referenced this pull request Feb 21, 2022
* Modify docs

* Support CPU training

* Modify docs

* Modify Chinese docs
ZwwWayne pushed a commit that referenced this pull request Jul 18, 2022
* Modify docs

* Support CPU training

* Modify docs

* Modify Chinese docs
ZwwWayne pushed a commit to ZwwWayne/mmdetection that referenced this pull request Jul 19, 2022
* Modify docs

* Support CPU training

* Modify docs

* Modify Chinese docs
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.

5 participants