-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedOpen to be worked onOpen to be worked on
Milestone
Description
🐛 Bug
Calling .save_hyperparameters() from a parent model doesn't save arguments of the child model.
To Reproduce
This is a very simple example that has two models, each inherits from a parent.
In the first one, the parent calls .save_hyperparameters() and in the second one the child does.
You can see that difference in .hparams in each of the models.
https://colab.research.google.com/drive/1J4Z8AFanZUIPMffj0ZO0yiKtlDto1OQw?usp=sharing
Expected behavior
It shouldn't matter where .save_hyperparameters() is called in the inheritance chain, all the parameters passed to the instantiated model should be saved in .hparams.
I believe the solution is already given with collect_init_args:
init_args = {}
for local_args in collect_init_args(frame, []):
init_args.update(local_args)
It worked for me, so let me know if you'd like me to submit a pull request.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedOpen to be worked onOpen to be worked on