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

[DataLoader2] Skip wrapping if serialization wrapper attached & deepcopy DataPipe in load_state_dict #833

Closed
wants to merge 1 commit into from

Conversation

ejguan
Copy link
Contributor

@ejguan ejguan commented Oct 14, 2022

Per title

  • We don't need to attach serialization wrapper if the last DataPipe has been _DataPipeSerializationWrapper
  • When we load_state_dict, we still need a copy of self.datapipe as it has been done in __init__ function. We should align the behavior of load_state_dict and __init__
    • Either deepcoy to self._datapipe_before_reading_service_adapt
    • Or skip deepcopy to self._datapipe_before_reading_service_adapt at those two places.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 14, 2022
@facebook-github-bot
Copy link
Contributor

@ejguan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@ejguan ejguan requested a review from NivekT October 14, 2022 21:59
Copy link
Contributor

@NivekT NivekT left a comment

Choose a reason for hiding this comment

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

LGTM! Question: do we expect any case where the datapipe being passed in already has a wrapper?

@ejguan
Copy link
Contributor Author

ejguan commented Oct 17, 2022

LGTM! Question: do we expect any case where the datapipe being passed in already has a wrapper?

It's more like a future proof. (Technically, if users manually deserialize the DataPipe state, the returned DataPipe is wrapped by the wrapper.

@ejguan ejguan mentioned this pull request Oct 17, 2022
ejguan added a commit to ejguan/data that referenced this pull request Oct 21, 2022
…n load_state_dict (pytorch#833)

Summary:
Per title
- We don't need to attach serialization wrapper if the last DataPipe has been `_DataPipeSerializationWrapper`
- When we `load_state_dict`, we still need a copy of `self.datapipe` as it has been done in `__init__` function. We should either do deepcoy to `self._datapipe_before_reading_service_adapt` or skip deepcopy to `self._datapipe_before_reading_service_adapt` at those two places.

Pull Request resolved: pytorch#833

Reviewed By: NivekT

Differential Revision: D40399573

Pulled By: ejguan

fbshipit-source-id: 16fc80bd005a4b8671d48780c7aea8f164bccba8
ejguan added a commit that referenced this pull request Oct 21, 2022
…n load_state_dict (#833)

Summary:
Per title
- We don't need to attach serialization wrapper if the last DataPipe has been `_DataPipeSerializationWrapper`
- When we `load_state_dict`, we still need a copy of `self.datapipe` as it has been done in `__init__` function. We should either do deepcoy to `self._datapipe_before_reading_service_adapt` or skip deepcopy to `self._datapipe_before_reading_service_adapt` at those two places.

Pull Request resolved: #833

Reviewed By: NivekT

Differential Revision: D40399573

Pulled By: ejguan

fbshipit-source-id: 16fc80bd005a4b8671d48780c7aea8f164bccba8
ejguan added a commit to ejguan/data that referenced this pull request Oct 23, 2022
…n load_state_dict (pytorch#833)

Summary:
Per title
- We don't need to attach serialization wrapper if the last DataPipe has been `_DataPipeSerializationWrapper`
- When we `load_state_dict`, we still need a copy of `self.datapipe` as it has been done in `__init__` function. We should either do deepcoy to `self._datapipe_before_reading_service_adapt` or skip deepcopy to `self._datapipe_before_reading_service_adapt` at those two places.

Pull Request resolved: pytorch#833

Reviewed By: NivekT

Differential Revision: D40399573

Pulled By: ejguan

fbshipit-source-id: 16fc80bd005a4b8671d48780c7aea8f164bccba8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants