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 non_blocking feature to BaseDataPreprocessor #618

Merged
merged 5 commits into from
Oct 18, 2022
Merged

add non_blocking feature to BaseDataPreprocessor #618

merged 5 commits into from
Oct 18, 2022

Conversation

shenmishajing
Copy link
Contributor

Motivation

add non_blocking param to BaseDataPreprocessor, which transfer tensor to device asynchronously. See https://pytorch.org/docs/stable/generated/torch.Tensor.to.html#torch.Tensor.to for detail.

Modification

add non_blocking param to BaseDataPreprocessor.

BC-breaking (Optional)

Every DataPreprocessor should add non_blocking param.

Use cases (Optional)

User can set pin_memory and non_blocking to True to transfer tensor from cpu to gpu asynchronously, instead of blocking the process when transfer data.

Checklist

  1. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMCls.
  2. The documentation has been modified accordingly, like docstring or example tutorials.

shenmishajing and others added 2 commits October 16, 2022 18:31
shenmishajing and others added 2 commits October 16, 2022 20:59
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
Copy link
Collaborator

@HAOCHENYE HAOCHENYE left a comment

Choose a reason for hiding this comment

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

LGTM.

@zhouzaida zhouzaida added this to the 0.3.0 milestone Oct 17, 2022
@shenmishajing
Copy link
Contributor Author

shenmishajing commented Oct 17, 2022

Hi, @zhouzaida @HAOCHENYE @C1rN09 , the check failed because pip can not upgrade it self. Can you give a see to it?

@ZwwWayne ZwwWayne merged commit c298272 into open-mmlab:main Oct 18, 2022
@ZwwWayne
Copy link
Collaborator

Since this PR is approved by all reviewers, it is merged first. The issue of CI can be solved in another PR.

@shenmishajing shenmishajing deleted the add_non_blocking_feature_to_data_preprocessor branch October 19, 2022 01:41
C1rN09 pushed a commit to C1rN09/mmengine that referenced this pull request Nov 1, 2022
…#618)

* add non_blocking feature to BaseDataPreprocessor

* Update mmengine/model/base_model/data_preprocessor.py

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* move new parameters to the last to avoid bc issue

* Update mmengine/model/base_model/data_preprocessor.py

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update mmengine/model/base_model/data_preprocessor.py

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
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.

5 participants