-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add custom hook by config file #970
Conversation
Codecov Report
@@ Coverage Diff @@
## master #970 +/- ##
==========================================
+ Coverage 64.57% 64.81% +0.23%
==========================================
Files 152 152
Lines 9810 9827 +17
Branches 1781 1788 +7
==========================================
+ Hits 6335 6369 +34
+ Misses 3145 3129 -16
+ Partials 330 329 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Overall the modification LGTM. Could you add a unit test to test those priorities of hooks with custom hooks, e.g., using the example you show in the PR message? |
Ok, I have added the unittest. |
Refer to #967
I noticed that mmcv hooks already have priority. Therefore, I assign different priorities to default hooks, so that, we can use priority value to indicate when a hook should run.
For example, I add a custom hook as:
And edit the
base_runner.call_hook
function to show the effect.Then, we can add custom hooks by config file with:
And get the result (I use mmcls to show the effect):