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

Allow frozen dataclasses in apply_to_collection #98

Merged
merged 3 commits into from Feb 7, 2023

Conversation

janEbert
Copy link
Contributor

@janEbert janEbert commented Feb 6, 2023

Before submitting
  • Was this discussed/agreed via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
    Docstring, yes.
  • Did all existing and newly added tests pass locally?
    No, some tests were broken even without my changes. However, all tests in test_apply_func.py, including my new one, passed.

What does this PR do?

Allow frozen dataclasses to be ignored in apply_to_collection. This is useful to allow ignoring values which we never cared about anyway, for example when using apply_to_collection to move data to a device.
This (combined with a change in the previously linked line, see main repo PR) allows saving optimizers for which the state includes frozen dataclasses that we just want to pass through.

Should be completely backward-compatible since I introduce a new keyword argument for this.

@Borda Borda added the enhancement New feature or request label Feb 7, 2023
@Borda Borda merged commit 9eab563 into Lightning-AI:main Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants