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

Fixed deadlock issue related with MMDetWandbHook #9476

Merged
merged 1 commit into from
Dec 12, 2022

Conversation

MilkClouds
Copy link

@MilkClouds MilkClouds commented Dec 10, 2022

Co-authored-by: WangYudong yudong.wang@akane.waseda.jp

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

Please refer to #8145.
To summarize problem, when we use MMDetWandbHook after TextLoggerHook, problem such as deadlock or AssertionError: loss log variables are different across GPUs! occurs. These are because of same reason and I summarized the reason in #8145 (comment) here.

Since same problem occurs in mmseg open-mmlab/mmsegmentation#2137, I'm going to make almost-same PR on mmseg after merge of this PR.

Modification

Made MMDetWandbHook to clear runner.log_buffer on every process, including process for GPU 1,2,3...

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMCls.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@MilkClouds
Copy link
Author

MilkClouds commented Dec 11, 2022

There was already a similar commit on mmcls open-mmlab/mmpretrain#1242, which I didn't know! (this commit was only 5 days ago, too.)
I spent quite a long time trying to figure out the cause of the bug, but there was someone who already figured out the causes :(
Anyway, please merge this PR. Even though detailed implementation is different with open-mmlab/mmpretrain#1242, purpose is the same.

Also I guess we don't need to separate after_train_epoch, since runner's output buffer is cleared before epoch. I'll test once and update PR.

@ZwwWayne ZwwWayne requested a review from hhaAndroid December 12, 2022 02:59
@ZwwWayne ZwwWayne changed the base branch from master to dev December 12, 2022 02:59
@codecov
Copy link

codecov bot commented Dec 12, 2022

Codecov Report

Base: 64.15% // Head: 64.14% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (df86a40) compared to base (31c8495).
Patch coverage: 66.66% of modified lines in pull request are covered.

❗ Current head df86a40 differs from pull request most recent head 36680cc. Consider uploading reports for the commit 36680cc to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #9476      +/-   ##
==========================================
- Coverage   64.15%   64.14%   -0.02%     
==========================================
  Files         361      361              
  Lines       29583    29585       +2     
  Branches     5033     5033              
==========================================
- Hits        18980    18977       -3     
- Misses       9599     9601       +2     
- Partials     1004     1007       +3     
Flag Coverage Δ
unittests 64.12% <66.66%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
mmdet/core/hook/wandblogger_hook.py 15.20% <66.66%> (+0.28%) ⬆️
mmdet/utils/setup_env.py 88.00% <0.00%> (-4.00%) ⬇️
mmdet/models/roi_heads/mask_heads/maskiou_head.py 87.35% <0.00%> (-2.30%) ⬇️
mmdet/datasets/builder.py 52.08% <0.00%> (-1.05%) ⬇️

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.

@MilkClouds MilkClouds force-pushed the fix_mmdetawndbhook_issue branch from 0e22252 to 68dc5a6 Compare December 12, 2022 05:48
Co-authored-by: WangYudong <yudong.wang@akane.waseda.jp>
@MilkClouds MilkClouds force-pushed the fix_mmdetawndbhook_issue branch from 68dc5a6 to 36680cc Compare December 12, 2022 05:54
@MilkClouds
Copy link
Author

MilkClouds commented Dec 12, 2022

I've verified my commit, and merged two commit in one. plz check and merge this.

@ZwwWayne ZwwWayne merged commit cc9513f into open-mmlab:dev Dec 12, 2022
thmegy pushed a commit to thmegy/mmdetection that referenced this pull request May 5, 2023
Co-authored-by: WangYudong <yudong.wang@akane.waseda.jp>

Co-authored-by: WangYudong <yudong.wang@akane.waseda.jp>
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.

4 participants