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

Support deprecation info in Config #1275

Merged
merged 5 commits into from
Aug 23, 2021
Merged

Conversation

ly015
Copy link
Member

@ly015 ly015 commented Aug 16, 2021

Motivation

Support deprecation information in Config. Users can add a field _deprecation_ into a config file, which will trigger a deprecation warning during calling Config.fromfile. Optionally, the warning information can include a path to the expected config file to replace the deprecated one.

Modification

  • Add deprecation information support in config.py
  • Add unittest

Use cases (Optional)

For example, if a config file old_config.py has been renamed to new_config.py. To avoid bc-breaking, we can create an old_config.py file with deprecation information as following:

_base_ = './new_config.py'
_deprecation_ = dict(expected='configs/new_config.py')

@codecov
Copy link

codecov bot commented Aug 16, 2021

Codecov Report

Merging #1275 (fce2cb1) into master (44edcdd) will increase coverage by 0.00%.
The diff coverage is 77.77%.

❗ Current head fce2cb1 differs from pull request most recent head bb5f201. Consider uploading reports for the commit bb5f201 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1275   +/-   ##
=======================================
  Coverage   68.42%   68.43%           
=======================================
  Files         160      160           
  Lines       10610    10619    +9     
  Branches     1938     1941    +3     
=======================================
+ Hits         7260     7267    +7     
  Misses       2975     2975           
- Partials      375      377    +2     
Flag Coverage Δ
unittests 68.43% <77.77%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
mmcv/image/photometric.py 99.27% <ø> (ø)
mmcv/ops/deform_conv.py 62.04% <ø> (ø)
mmcv/ops/fused_bias_leakyrelu.py 30.90% <ø> (ø)
mmcv/runner/hooks/ema.py 90.69% <ø> (ø)
mmcv/runner/hooks/evaluation.py 89.08% <ø> (ø)
mmcv/utils/registry.py 98.31% <ø> (ø)
mmcv/utils/config.py 90.10% <77.77%> (-0.29%) ⬇️

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 44edcdd...bb5f201. Read the comment docs.

@ZwwWayne
Copy link
Collaborator

The modification LGTM. It would be better to also update the documentation thus the users could know it right after this PR.

@innerlee
Copy link
Contributor

It would be great to provide a link to the related pr

@innerlee
Copy link
Contributor

innerlee commented Aug 18, 2021

I'm not sure about the usecase. If a user uses the wrong config file in his/her own config, then how should he/she get the warning?

I see

@ly015
Copy link
Member Author

ly015 commented Aug 18, 2021

It would be great to provide a link to the related pr

You mean adding a key to the _deprecatoin_ dict in the config file, like reference or url?

@innerlee
Copy link
Contributor

Yes, the pr will be very helpful since its diff provides many live examples

@ZwwWayne ZwwWayne mentioned this pull request Aug 19, 2021
13 tasks
@ZwwWayne ZwwWayne merged commit 4d9b43d into open-mmlab:master Aug 23, 2021
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