-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Refactor] add config checker #2153
Conversation
'guide_to_framework.html#step3-model' | ||
|
||
logger: MMLogger = MMLogger.get_current_instance() | ||
logger.info(total_info) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, this info should be a user warning
instead of info
# The following function automatically detects outdated | ||
# configurations and updates them accordingly, while also providing | ||
# clear and concise information on the changes made. | ||
neck, head = check_and_update_config(neck, head) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this function should also take the backbone cfg as input, so that it can be used as a more general check and auto-update process for the entire model, rather than just for compatibility measures with the previous PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also have a concern that at the beginning of the training, mmengine
will print the entire config and dump a config file. Will this automatically processed function affect the above content? Such automatic modification seems to cause differences between the real model structure and the output. Do you think there is any way to optimize it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When trying to inference a model with SyncBN
on cpu
, it will raise an error. I think we can check the device and automatically repalce SyncBN
as BN
in the config dict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When trying to inference a model with
SyncBN
oncpu
, it will raise an error. I think we can check the device and automatically repalceSyncBN
asBN
in the config dict.
SyncBN
can be converted to BN
by mmengine.model.revert_sync_batchnorm
. The Inferencer has supported this conversion in #2152
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also have a concern that at the beginning of the training,
mmengine
will print the entire config and dump a config file. Will this automatically processed function affect the above content? Such automatic modification seems to cause differences between the real model structure and the output. Do you think there is any way to optimize it?
We can modify this checker to a hook in the future, and add more functions to it.
Motivation
#2108 and #2126 modified the interface of neck and head. If users use the latest mmpose and old configs, there might be some conflict.
Modification
add a function
check_and_update_config
that checks if the config is consistent with the latest mmpose. If not, the arguments will be automatically updated. In addition, this function will display the guide for updating the configs, such asand
add unit test for
check_and_update_config
verify the test accuracy of
cid_hrnet-w32_8xb20-140e_coco-512x512
,td-hm_ViTPose-base-simple_8xb64-210e_coco-256x192
,td-hm_pvt-s_8xb64-210e_coco-256x192
BC-breaking (Optional)
Use cases (Optional)
Checklist
Before PR:
After PR: