-
Notifications
You must be signed in to change notification settings - Fork 505
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
@dataclass-style structured configs to @attrs-style #1172
@dataclass-style structured configs to @attrs-style #1172
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.
LGTM, did you do some testings to make sure we do not have issues with overwriting configs?
class SceneSamplerParamsConfig: | ||
scene: str = "v3_sc1_staging_00" | ||
scene_sets: List[Any] = field(default_factory=list) | ||
scene_sets: List[Any] = [] |
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.
I am against doing this as this technically bad behavior. I would rather we stick to dataclasses and wrap it with this: https://pypi.org/project/dataslots/
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.
The main issue here is that the list can be edited and it will affect the DEFAULT parameters of the config which is unexpected behavior and bugprone.
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.
We should consider sticking with dataclasses. They are better supported and I don't see any performance gains from doing it here. The are some nice features like validators, but we aren't using them currently. One of the nice things about having these files as dataclasses is that we can define them without Hydra. Not having a attrs.Factory of fields initializer creates bugprone behavior since our default args are mutable.
This was planned to be a follow-up PR to #1120, where you actually asked and approved structured configs to be attrs-style. We should agree how do we define structured configs and either rollback structured config definition changes in #1120 or in this PR to make our code consistent. |
This PR can actually be decomposed into two:
|
I didn't observe any issues during development if structured configs (parent and child) are defined the same style. Though, I didn't test extensively. |
Closing in favour of #1182. |
Motivation and Context
How Has This Been Tested
Types of changes
Checklist