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

Fix the serialization of partial functions in nemo 2.0 #9668

Merged
merged 4 commits into from
Jul 17, 2024

Conversation

sararb
Copy link
Collaborator

@sararb sararb commented Jul 10, 2024

What does this PR do ?

Add a one line overview of what this PR aims to accomplish.

Collection: [Note which collection this PR will affect]

Changelog

  • Add specific line by line info of high level changes in this PR.

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this 

GitHub Actions CI

The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.

The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".

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:

  • 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)

@@ -110,6 +112,8 @@ def enable():
def _modified_serialize(self, value, current_path, all_paths=None):
if isinstance(value, types.BuiltinFunctionType):
return self._pyref(value, current_path)
if isinstance(value, partial) and not value.args:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't we be able to handle value.args as well?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could be good to add some unit-tests for this potentially

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the review! I added support to value.args. Also, as discussed, I added a unit test that saves and re-load a TrainerContext with a partial function that has positional and keywords args.

@sararb sararb force-pushed the srabhi/fix_serialization_partial_func branch from b5e5ac1 to c53ca79 Compare July 12, 2024 19:30
Signed-off-by: srabhi <srabhi@nvidia.com>
Signed-off-by: srabhi <srabhi@nvidia.com>
Signed-off-by: srabhi <srabhi@nvidia.com>
@sararb sararb force-pushed the srabhi/fix_serialization_partial_func branch from ec2f16b to c08460e Compare July 17, 2024 13:50
@sararb sararb requested a review from ashors1 July 17, 2024 15:45
Copy link
Collaborator

@ashors1 ashors1 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!

@ashors1 ashors1 added Run CICD and removed Run CICD labels Jul 17, 2024
@sararb sararb merged commit f65fea2 into main Jul 17, 2024
210 checks passed
@sararb sararb deleted the srabhi/fix_serialization_partial_func branch July 17, 2024 18:28
ertkonuk pushed a commit that referenced this pull request Jul 19, 2024
* fix serialization of partial function

* update serialization to handle value.args

Signed-off-by: srabhi <srabhi@nvidia.com>

* add unit test

Signed-off-by: srabhi <srabhi@nvidia.com>

* remove redundant code from unit-test

Signed-off-by: srabhi <srabhi@nvidia.com>

---------

Signed-off-by: srabhi <srabhi@nvidia.com>
Signed-off-by: Tugrul Konuk <ertkonuk@gmail.com>
tonyjie pushed a commit to tonyjie/NeMo that referenced this pull request Jul 24, 2024
* fix serialization of partial function

* update serialization to handle value.args

Signed-off-by: srabhi <srabhi@nvidia.com>

* add unit test

Signed-off-by: srabhi <srabhi@nvidia.com>

* remove redundant code from unit-test

Signed-off-by: srabhi <srabhi@nvidia.com>

---------

Signed-off-by: srabhi <srabhi@nvidia.com>
akoumpa pushed a commit that referenced this pull request Jul 25, 2024
* fix serialization of partial function

* update serialization to handle value.args

Signed-off-by: srabhi <srabhi@nvidia.com>

* add unit test

Signed-off-by: srabhi <srabhi@nvidia.com>

* remove redundant code from unit-test

Signed-off-by: srabhi <srabhi@nvidia.com>

---------

Signed-off-by: srabhi <srabhi@nvidia.com>
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
malay-nagda pushed a commit to malay-nagda/NeMo that referenced this pull request Jul 26, 2024
* fix serialization of partial function

* update serialization to handle value.args

Signed-off-by: srabhi <srabhi@nvidia.com>

* add unit test

Signed-off-by: srabhi <srabhi@nvidia.com>

* remove redundant code from unit-test

Signed-off-by: srabhi <srabhi@nvidia.com>

---------

Signed-off-by: srabhi <srabhi@nvidia.com>
Signed-off-by: Malay Nagda <malayn@malayn-mlt.client.nvidia.com>
monica-sekoyan pushed a commit that referenced this pull request Oct 14, 2024
* fix serialization of partial function

* update serialization to handle value.args

Signed-off-by: srabhi <srabhi@nvidia.com>

* add unit test

Signed-off-by: srabhi <srabhi@nvidia.com>

* remove redundant code from unit-test

Signed-off-by: srabhi <srabhi@nvidia.com>

---------

Signed-off-by: srabhi <srabhi@nvidia.com>
hainan-xv pushed a commit to hainan-xv/NeMo that referenced this pull request Nov 5, 2024
* fix serialization of partial function

* update serialization to handle value.args

Signed-off-by: srabhi <srabhi@nvidia.com>

* add unit test

Signed-off-by: srabhi <srabhi@nvidia.com>

* remove redundant code from unit-test

Signed-off-by: srabhi <srabhi@nvidia.com>

---------

Signed-off-by: srabhi <srabhi@nvidia.com>
Signed-off-by: Hainan Xu <hainanx@nvidia.com>
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.

3 participants