Skip to content
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

Closed
wants to merge 9 commits into from

Conversation

ZwwWayne
Copy link
Collaborator

@ZwwWayne ZwwWayne commented Dec 6, 2020

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.

@codecov
Copy link

codecov bot commented Dec 6, 2020

Codecov Report

Merging #695 (cd92f81) into master (4f0f1f9) will decrease coverage by 0.32%.
The diff coverage is 59.63%.

Impacted file tree graph

@@            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     
Flag Coverage Δ
unittests 64.53% <59.63%> (-0.33%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmcv/engine/test.py 15.78% <15.78%> (ø)
mmcv/engine/utils.py 71.08% <71.08%> (ø)
mmcv/engine/__init__.py 100.00% <100.00%> (ø)
mmcv/runner/base_runner.py 69.01% <100.00%> (ø)
mmcv/utils/config.py 90.51% <100.00%> (+0.39%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4f0f1f9...cd92f81. Read the comment docs.

@xvjiarui
Copy link
Collaborator

xvjiarui commented Dec 7, 2020

train.py is an empty file.

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)
Copy link
Member

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)
Copy link
Member

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):
Copy link
Member

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):
Copy link
Member

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add detailed description on:

  1. the priority
  2. some examples


def setup_cfg(args, cfg_args):
"""Set up config.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a detailed description.

@ZwwWayne
Copy link
Collaborator Author

As there is a new plan. The proposal of a unified entrypoint has been deprecated and this PR is closed.

@ZwwWayne ZwwWayne closed this Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants