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 bug when using iterbaserunner with 'val' workflow #542

Merged
merged 4 commits into from
Nov 22, 2021

Conversation

Ezra-Yu
Copy link
Collaborator

@Ezra-Yu Ezra-Yu commented Nov 18, 2021

Motivation

fix bug when using iterbaserunner with 'val' workflow. refer to #535
Align the train_step and val_step with epochBaseRunner and iterBaseRunner in mmcv

Modification

add a default value None for optimizer
add kwargs

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.

@Ezra-Yu Ezra-Yu added the Bug Something isn't working label Nov 18, 2021
@Ezra-Yu Ezra-Yu requested a review from mzr1996 November 18, 2021 02:57
@codecov
Copy link

codecov bot commented Nov 18, 2021

Codecov Report

Merging #542 (a498f07) into master (771d105) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #542   +/-   ##
=======================================
  Coverage   79.87%   79.88%           
=======================================
  Files         107      107           
  Lines        6093     6095    +2     
  Branches      987      988    +1     
=======================================
+ Hits         4867     4869    +2     
  Misses       1094     1094           
  Partials      132      132           
Flag Coverage Δ
unittests 79.88% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
mmcls/models/classifiers/base.py 69.62% <100.00%> (ø)
mmcls/datasets/pipelines/transforms.py 88.22% <0.00%> (+0.04%) ⬆️

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 771d105...a498f07. Read the comment docs.

@Ezra-Yu Ezra-Yu requested a review from mzr1996 November 19, 2021 10:23
optimizer (:obj:`torch.optim.Optimizer` | dict): The optimizer of
runner is passed to ``train_step()``. This argument is unused
and reserved.
optimizer (:obj:`torch.optim.Optimizer` | dict | optional): The
Copy link
Member

Choose a reason for hiding this comment

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

Well, the right usage should be

Suggested change
optimizer (:obj:`torch.optim.Optimizer` | dict | optional): The
optimizer (:obj:`torch.optim.Optimizer` | dict, optional): The

Because optional is not a type, but a kind of annotation.

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.

LGTM

@mzr1996 mzr1996 merged commit f361bd5 into open-mmlab:master Nov 22, 2021
@Ezra-Yu Ezra-Yu deleted the fix-val_step branch July 18, 2022 08:45
mzr1996 pushed a commit to mzr1996/mmpretrain that referenced this pull request Nov 24, 2022
…n-mmlab#542)

* add kwargs and default of optimizer in train_step and val_step

* update docstring

* update docstring

* update optional annotation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants