-
Notifications
You must be signed in to change notification settings - Fork 92
Update callbacks and tests #482
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
Conversation
| """PINA Callbacks Implementations""" | ||
|
|
||
| # To remove once Callbacks are implemented again. | ||
| # pylint: disable=W0611 |
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 would remove this for now. Maybe, we will restore them in the future but for now I would keep all the warnings
pina/callback/optimizer_callback.py
Outdated
| self._new_optimizers = new_optimizers | ||
| self._epoch_switch = epoch_switch | ||
|
|
||
| # pylint: disable=W0212 |
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.
Also here! I suggest to remove this
| for idx, optim in enumerate(self._new_optimizers): | ||
| optim.hook(trainer.solver.models[idx].parameters()) | ||
| optims.append(optim.instance) | ||
| optim.hook(trainer.solver._pina_models[idx].parameters()) |
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 are accessing a private member of the solver class. Isn't a cleaner way to do the same thing?
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.
Nope, this is the only way to work for all solvers.
GiovanniCanali
left a comment
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.
Thank you, @dario-coscia, for fixing the callbacks. Code looks good to me!
While I believe the docstrings will be addresses in the corresponding PR, I am leaving some comments to point out some minor inconsistencies.
I am also committing some small rephrasing modifications and typos corrections.
pina/callback/processing_callback.py
Outdated
| """ | ||
| Lightning Callback for Metric Tracking. | ||
| Tracks specific metrics during the training process. |
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 suggest to move the description of callbacks to the class docstring, and fill the docstring of __init__ methods with brief sentences, such as "Initialization" for instance. What do you think?
pina/callback/processing_callback.py
Outdated
| :param metrics_to_track: List of metrics to track. Defaults to train/val loss. | ||
| :param metrics_to_track: List of metrics to track. | ||
| Defaults to train loss. | ||
| :type metrics_to_track: list, optional |
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.
In some cases, the type list is used generically, while in others, the specific types of instances within the list are explicitly defined. What convention should we follow?
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.
Thank! You are right it should be list of str
|
Can we merge? |
|
Ok for me! |
1f54775 to
795e4a4
Compare
|
Yes! |
|
Ready to merge! |
7eec394 to
795e4a4
Compare
--------- Co-authored-by: giovanni <[email protected]>
--------- Co-authored-by: giovanni <[email protected]>
--------- Co-authored-by: giovanni <[email protected]>
--------- Co-authored-by: giovanni <[email protected]>
--------- Co-authored-by: giovanni <[email protected]>
--------- Co-authored-by: giovanni <[email protected]>
--------- Co-authored-by: giovanni <[email protected]>
In this PR the PINA callbacks and related tests are updated.
The Refinment callback is deprecated, see issue #481