open-mmlab / mmselfsup

OpenMMLab Self-Supervised Learning Toolbox and Benchmark
https://mmselfsup.readthedocs.io/en/latest/
Apache License 2.0
3.18k stars 428 forks source link

[Fix] Fix key error in default_runtime.py #681

Closed GeoffreyChen777 closed 1 year ago

GeoffreyChen777 commented 1 year ago

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

If set by_epoch=False for log_processor, an error is raised:

  File "/home/WMGDS.WMG.WARWICK.AC.UK/chen_c/project/mmengine/mmengine/runner/log_processor.py", line 314, in _check_window_size
    assert log_cfg['window_size'] != 'epoch', \
  File "/home/WMGDS.WMG.WARWICK.AC.UK/chen_c/project/mmengine/mmengine/config/config.py", line 47, in __missing__
    raise KeyError(name)
KeyError: 'window_size'

The reason is that here log_processor is checking the window_size, not windows_size:

https://github.com/open-mmlab/mmengine/blob/50465a20022938444f90314e9ce217607d8c215c/mmengine/runner/log_processor.py#L352

But in the default_runtime.py, it's windows_size:

https://github.com/open-mmlab/mmselfsup/blob/c152d1451bb40efa37dcf14ab11c91cab38ee0f4/configs/selfsup/_base_/default_runtime.py#L20

Modification

modified the default_runtime.py config file.

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.

Use cases (Optional)

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

Checklist

Before PR:

After PR:

fangyixiao18 commented 1 year ago

Hi, thanks for your contribution. Please pull the latest dev-1.x branch, and rebase to dev-1.x, then we will merge your pr.

GeoffreyChen777 commented 1 year ago

Hi, thanks for your contribution. Please pull the latest dev-1.x branch, and rebase to dev-1.x, then we will merge your pr.

done