-
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
Support storing hparams as a dict #977
Comments
It would also be great to support nested dictionaries. Especially for hydra users, because this library favors modular configs. |
#943 Started also here with suggestion, but not sure what is the right way to do it. |
What about having a |
I like your idea of the mandatory hparams argument to the constructor. If the superclass takes care of storing the hparams, it even gives the user more flexibility, for example he/she can rename it to self.args or something. It would also simplify the logic in the load method (e.g. LightningModule.load_from_checkpoint). |
There is still the question of how we support multiple types of hparam objects and instantiate the user's LightningModule in the load_from_checkpoint method. |
On the other hand, adding a mandatory argument will break a lot of existing code. What if instead use a |
@awaelchli You can just type-check them and then convert it to some common type, e.g., a dict. |
@tstumm I meant the second option, this method may be called by
I should say we need a really good reason to introduce a change that will break a lot of code. |
hmmm, so what about having |
What if the hparams changes after setter is called? It is mutable, the user can change the values anytime. It should probably only be converted when checkpoint is saved. |
🚀 Feature
Right now, we assume
model.hparams
is anargparse.Namespace
. We've had a number of requests to supporthparams
as a simpledict
. Let's do it.The text was updated successfully, but these errors were encountered: