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

[Fix] Remove DistSamplerSeedHook if use IterBasedRunner. #501

Conversation

youqingxiaozhua
Copy link
Contributor

Motivation

When using IterBasedRunner, it will raise the AttributeError: 'IterBasedRunner' object has no attribute 'data_loader' in DistSamplerSeedHook during the before_epoch.

According to the comments, there is no need to register the DistSamplerSeedHook for IterBasedRunner, so I remove it.

Modification

see the diff below

BC-breaking (Optional)

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

NO

@CLAassistant
Copy link

CLAassistant commented Oct 27, 2021

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Oct 27, 2021

Codecov Report

Merging #501 (2169cb5) into master (52e6256) will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #501   +/-   ##
=======================================
  Coverage   78.94%   78.94%           
=======================================
  Files         104      104           
  Lines        5760     5760           
  Branches      933      933           
=======================================
  Hits         4547     4547           
  Misses       1089     1089           
  Partials      124      124           
Flag Coverage Δ
unittests 78.94% <0.00%> (ø)

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

Impacted Files Coverage Δ
mmcls/apis/train.py 22.72% <0.00%> (ø)

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 52e6256...2169cb5. Read the comment docs.

mmcls/apis/train.py Outdated Show resolved Hide resolved
@mzr1996 mzr1996 changed the title remove DistSamplerSeedHook for IterBasedRunner [Fix] Remove DistSamplerSeedHook if use IterBasedRunner. Oct 27, 2021
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.

Looks good

@mzr1996 mzr1996 merged commit 1177feb into open-mmlab:master Oct 27, 2021
mzr1996 added a commit to mzr1996/mmpretrain that referenced this pull request Nov 24, 2022
…lab#501)

* remove DistSamplerSeedHook for IterBasedRunner

* Register DistSamplerSeedHook for EpochBasedRunner only

Co-authored-by: Ma Zerun <[email protected]>

Co-authored-by: Ma Zerun <[email protected]>
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