-
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 engine for unified entrypoints in downstream projects #695
Conversation
Codecov Report
@@ Coverage Diff @@
## master #695 +/- ##
==========================================
- Coverage 64.85% 64.53% -0.33%
==========================================
Files 136 139 +3
Lines 7989 8165 +176
Branches 1411 1440 +29
==========================================
+ Hits 5181 5269 +88
- Misses 2539 2618 +79
- Partials 269 278 +9
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
time.sleep(2) # This line can prevent deadlock problem in some cases. | ||
for i, data in enumerate(data_loader): | ||
with torch.no_grad(): | ||
result = model(return_loss=False, rescale=True, **data) |
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.
This may not be applicable to all downstream codebases.
results.extend(result) | ||
|
||
if rank == 0: | ||
batch_size = len(result) |
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.
Is this true for all codebases?
return results | ||
|
||
|
||
def collect_results_cpu(result_part, size, tmpdir=None): |
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.
Add a docstring.
return ordered_results | ||
|
||
|
||
def collect_results_gpu(result_part, size): |
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.
Add a docstring.
@@ -62,6 +62,89 @@ def add_args(parser, cfg, prefix=''): | |||
return parser | |||
|
|||
|
|||
def parse_int_float_bool(val): | |||
"""Parse string value to be integer, float, or boolean value. |
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.
Add detailed description on:
- the priority
- some examples
|
||
def setup_cfg(args, cfg_args): | ||
"""Set up config. | ||
|
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.
Add a detailed description.
As there is a new plan. The proposal of a unified entrypoint has been deprecated and this PR is closed. |
This PR adds a directory named engine in MMCV, which implements and unifies common functions for starting a training/testing process in downstream codebases. With
mmcv.engine
, downstream codebases like MMAction or MMClassification could directly use these functions and share a similar entry point script for training or testing a model.This PR does not affect its dependencies' functionality, but its dependencies could update and unify their training/testing scripts after this PR is merged.