-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Fix frozen dataclass instance error in apply_to_collection
#10927
Fix frozen dataclass instance error in apply_to_collection
#10927
Conversation
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.
Sorry, but I feel I need to block this for now. I think this violates the core idea of a python frozen dataclass (which is being immutable) and therefore it should not be hacked around this. Let's discuss in #10873 .
If I'm outvoted I will happily open this PR again. Just want to prevent merging until a common decision was made
Sure, makes sense. I did not think of it as a way to prevent python from doing its job. |
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.
Raised error instead of forcing the apply
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.
@abhi-rf Would you mind to also add a test case for this?
Sure, I can surely give it a try!! |
@abhi-rf You can find its existing tests in |
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.
LGTM !
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you need further help see our docs: https://pytorch-lightning.readthedocs.io/en/latest/generated/CONTRIBUTING.html#pull-request or ask the assistance of a core contributor here or on Slack. Thank you for your contributions. |
apply_to_collection
The blocking review is outdated. The original error is respected
What does this PR do?
changed the set_attribute function in in the apply_to_collection for recursively applying a function to all elements of a certain dtype in utilities/apply_func.py to Work with frozen dataclass Also now.
Fixes #10873
Does your PR introduce any breaking changes? If yes, please list them.
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun? Yes
Make sure you had fun coding 🙃