-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Enhance flexibility by passing callbacks as method argument #8015
Conversation
acbe3d7
to
c748a8c
Compare
5e24036
to
1b588da
Compare
@titu1994 could you also please help to review this? Short one, focusing on UX |
@@ -95,10 +95,10 @@ def _plugins(self) -> list: | |||
|
|||
return plugins | |||
|
|||
def create_trainer(self) -> Trainer: | |||
def create_trainer(self, callbacks=(CustomProgressBar(),)) -> Trainer: |
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.
Don't instantiate objects in function signature. Default to None, check if None inside the function and the. Instantiate the value you need. Only primitive values are safe in function signature. https://leimao.github.io/blog/Python-Default-Argument-Mutable-Object/
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.
Fixed
a1d1471
to
f513a32
Compare
This PR is stale because it has been open for 14 days with no activity. Remove stale label or comment or update or this will be closed in 7 days. |
This PR was closed because it has been inactive for 7 days since being marked as stale. |
@titu1994 could you have another look? |
Signed-off-by: Michal Futrega <michal.futrega@gmail.com>
Signed-off-by: Michal Futrega <michal.futrega@gmail.com>
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 thanks !
) * Enhance flexibility by passing callbacks as method argument Signed-off-by: Michal Futrega <michal.futrega@gmail.com> * Set callbacks default to None Signed-off-by: Michal Futrega <michal.futrega@gmail.com> --------- Signed-off-by: Michal Futrega <michal.futrega@gmail.com> Signed-off-by: Sasha Meister <ameister@nvidia.com>
What does this PR do ?
This PR enhances the flexibility of CustomProgressBar by modifying the create_trainer method to accept callbacks as a method argument, replacing its previous fixed implementation.
Collection: NLP
Changelog
Moved callbacks to method arguement.
Usage
N/A
Jenkins CI
To run Jenkins, a NeMo User with write access must comment
jenkins
on the PR.Before your PR is "Ready for review"
Pre checks:
PR Type:
If you haven't finished some of the above items you can still open "Draft" PR.
Who can review?
Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.
Additional Information