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

Assert "valid" values for hyperparams in the Config #62

Open
1 task
bhavnicksm opened this issue Jun 15, 2024 · 0 comments
Open
1 task

Assert "valid" values for hyperparams in the Config #62

bhavnicksm opened this issue Jun 15, 2024 · 0 comments
Assignees

Comments

@bhavnicksm
Copy link
Contributor

bhavnicksm commented Jun 15, 2024

The configs do not have precise checks for the values that are passed to them, which allows for misunderstandings or illegal hyperparameter settings.

For example

config = AdamConfig(beta_1=-1) #this should not be possible

The duty of the config itself is to manage the class parameters well, store them in one location, handle inheritance properly without tedious calls, and do proper checks.

Data-classes in Python are great for handling the parameters, basic type checking, storing and exporting in different ways, but the "valid" value checking is not available behaviour by default.

Data-classes have the __post_init__ method which seems like a good candidate for ad-hoc checking at the moment, but the __post_init__ does not work properly with inheritance. That means, that when class B inherits class A, class B can completely override the __post_init__ defined by class A, leading to issues.

PyDantic is another option as well. Personally, the checking and the JSON serialization are great. But I want to avoid having more dependencies if possible.

Another thing is, I eventually plan to add PyYAML to the dependencies too, so it might become too heavy.

To do

  • Check if PyDantic works well with Multiple Inheritance
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

No branches or pull requests

1 participant