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

[Nemo-UX] IO fixes #9512

Merged
merged 39 commits into from
Jun 26, 2024
Merged

[Nemo-UX] IO fixes #9512

merged 39 commits into from
Jun 26, 2024

Conversation

marcromeyn
Copy link
Collaborator

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)


from nemo.lightning.io.mixin import ConnectorMixin, ConnT, ModelConnector
from nemo.lightning.io.pl import TrainerCheckpoint
from nemo.lightning.io.pl import TrainerContext

Check notice

Code scanning / CodeQL

Cyclic import Note

Import of module
nemo.lightning.io.pl
begins an import cycle.
@marcromeyn marcromeyn marked this pull request as ready for review June 25, 2024 12:28
Signed-off-by: marcromeyn <marcromeyn@users.noreply.github.com>
marcromeyn and others added 2 commits June 26, 2024 11:36
Signed-off-by: marcromeyn <marcromeyn@users.noreply.github.com>
)


def enable():
Copy link
Collaborator

@akoumpa akoumpa Jun 26, 2024

Choose a reason for hiding this comment

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

how about naming it to register_pytorch_extensions()

def _io_unflatten_object(values, metadata):
if len(values) == 1:
encoded_data = values[0]
pickled_data = base64.b64decode(encoded_data.encode('utf-8'))
Copy link
Collaborator

Choose a reason for hiding this comment

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

does fiddle have a binary format? b64 will need like 30% more space

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So this is a fallback scenario for things we don't know how to serialize, we expect to not need this for the big majority of use-cases. I guess we could change the design by not putting the pickled things inside the json but in external binary formatted files?

@akoumpa akoumpa merged commit 3371ad5 into main Jun 26, 2024
112 of 113 checks passed
@akoumpa akoumpa deleted the nemo-ux/io-fixes branch June 26, 2024 14:19
ashors1 pushed a commit that referenced this pull request Jul 5, 2024
* Improve IOMixin.io_transform_args to handle dataclasses better

* Dump task json + img inside NeMoLogger

* Adding store_io to train task

* Update opt.connect to also propagate to __io__

* Rename opt to optim for consistency

* Moving to using safe serialization using fiddle, only use cloudpickle when needed

* Apply isort and black reformatting

Signed-off-by: marcromeyn <marcromeyn@users.noreply.github.com>

* Using Config from fiddle instead of sdk for now

* Apply isort and black reformatting

Signed-off-by: marcromeyn <marcromeyn@users.noreply.github.com>

* Move enable_nemo_ckpt_io from MegatronStrategy to ModelCheckpoint

* Apply isort and black reformatting

Signed-off-by: marcromeyn <marcromeyn@users.noreply.github.com>

* Move nemo-ckpt to _get_finalize_save_checkpoint_callback

* Apply isort and black reformatting

Signed-off-by: marcromeyn <marcromeyn@users.noreply.github.com>

* Update TrainerContext & io.load_ckpt

* Use renamed TrainerContext inside ModelCheckpoint

* Remove double io saving

* Rename lightning.pytorch.opt -> optim

* Apply isort and black reformatting

Signed-off-by: marcromeyn <marcromeyn@users.noreply.github.com>

* Remove store_io from train-task

* Adding fiddle-extension for torch

* Apply isort and black reformatting

Signed-off-by: marcromeyn <marcromeyn@users.noreply.github.com>

* Move fdl_torch import

* Apply isort and black reformatting

Signed-off-by: marcromeyn <marcromeyn@users.noreply.github.com>

* Adding dtype to serialization

* Some fixes

* Apply isort and black reformatting

Signed-off-by: marcromeyn <marcromeyn@users.noreply.github.com>

* Make TransformerConfig inherit from IOMixin to fix serialization error

* Make TransformerConfig inherit from IOMixin to fix serialization error

* Apply isort and black reformatting

Signed-off-by: marcromeyn <marcromeyn@users.noreply.github.com>

* Add support for BuiltinFunctionType

* Apply isort and black reformatting

Signed-off-by: marcromeyn <marcromeyn@users.noreply.github.com>

* Add missing import

* Apply isort and black reformatting

Signed-off-by: marcromeyn <marcromeyn@users.noreply.github.com>

* Fix dataclass fields

---------

Signed-off-by: marcromeyn <marcromeyn@users.noreply.github.com>
Co-authored-by: marcromeyn <marcromeyn@users.noreply.github.com>
Signed-off-by: ashors1 <ashors@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.

None yet

2 participants