-
Notifications
You must be signed in to change notification settings - Fork 381
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
[Feature] Support registry auto import modules. #643
Conversation
de4d71b
to
cda0485
Compare
cda0485
to
2fd85ef
Compare
Codecov ReportBase: 78.66% // Head: 78.83% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #643 +/- ##
==========================================
+ Coverage 78.66% 78.83% +0.16%
==========================================
Files 128 128
Lines 9348 9399 +51
Branches 1848 1862 +14
==========================================
+ Hits 7354 7410 +56
+ Misses 1679 1673 -6
- Partials 315 316 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
never_created = DefaultScope.get_current_instance( | ||
) is None or not DefaultScope.check_instance_created(scope) |
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.
check_instance_created
only checks the instance name rather than the scope name.
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.
It is exactly used to check the instance with the name of scope here.
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.
It would be better to add this usage to |
171be5b
to
ae5ebb2
Compare
## Motivation The registry now supports auto-import modules from the given location. register_all_modules before running is no longer needed. The modules will be lazy-imported during building. - [x] This PR can be merged after open-mmlab/mmengine#643. The MMEngine version should be updated. Ref: open-mmlab/mmdetection#9143
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
Support auto-import modules from pre-defined locations.
Use lazy import during building to avoid registering useless modules at the beginning.
Modification
Modify the
get
method.Use case
in mmdet/registry.py
and then the
regsiter_all_modules
is no longer neededMore details at open-mmlab/mmdetection#9143.
BC-Breaking
None
Verified in MMDetection, MMClassification, MMYOLO, and MMSelfsup.