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

Enhance flexibility by passing callbacks as method argument #8015

Merged
merged 2 commits into from
Jan 9, 2024

Conversation

michal2409
Copy link
Collaborator

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:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • Refactor
  • New Feature
  • Bugfix
  • Documentation

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

  • Related to # (issue)

@janekl
Copy link
Collaborator

janekl commented Dec 14, 2023

@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:
Copy link
Collaborator

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/

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@michal2409 michal2409 force-pushed the callback_fix branch 2 times, most recently from a1d1471 to f513a32 Compare December 14, 2023 09:45
Copy link
Contributor

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.

@github-actions github-actions bot added the stale label Dec 29, 2023
Copy link
Contributor

github-actions bot commented Jan 5, 2024

This PR was closed because it has been inactive for 7 days since being marked as stale.

@github-actions github-actions bot closed this Jan 5, 2024
@janekl janekl reopened this Jan 5, 2024
@janekl
Copy link
Collaborator

janekl commented Jan 5, 2024

@titu1994 could you have another look?

Copy link
Collaborator

@titu1994 titu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm thanks !

@titu1994 titu1994 merged commit 76a712a into NVIDIA:main Jan 9, 2024
10 checks passed
minitu pushed a commit to minitu/NeMo that referenced this pull request Jan 19, 2024
)

* Enhance flexibility by passing callbacks as method argument

Signed-off-by: Michal Futrega <[email protected]>

* Set callbacks default to None

Signed-off-by: Michal Futrega <[email protected]>

---------

Signed-off-by: Michal Futrega <[email protected]>
ssh-meister pushed a commit to ssh-meister/NeMo that referenced this pull request Feb 15, 2024
)

* Enhance flexibility by passing callbacks as method argument

Signed-off-by: Michal Futrega <[email protected]>

* Set callbacks default to None

Signed-off-by: Michal Futrega <[email protected]>

---------

Signed-off-by: Michal Futrega <[email protected]>
Signed-off-by: Sasha Meister <[email protected]>
rohitrango pushed a commit to rohitrango/NeMo that referenced this pull request Jun 25, 2024
)

* Enhance flexibility by passing callbacks as method argument

Signed-off-by: Michal Futrega <[email protected]>

* Set callbacks default to None

Signed-off-by: Michal Futrega <[email protected]>

---------

Signed-off-by: Michal Futrega <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants