enables default data step in megatron parallel to operate on a wider variety of tensors#9641
Conversation
…variety of tensors coming out of the dataloader
3f53682 to
70cd4c4
Compare
Signed-off-by: jomitchellnv <jomitchellnv@users.noreply.github.com>
nemo/lightning/megatron_parallel.py
Outdated
| # Canonical case. | ||
| case batch: | ||
| pass | ||
| # If the dataloader_iter is empty, return None. |
There was a problem hiding this comment.
This comment is not what happens anymore. Now in your else you say raise ValueError(...):. Are we sure we don't want to pass through a None on the iter? Otherwise we should prob change line 79 or 84 to return None and drop the ValueError piece.
There was a problem hiding this comment.
Actually what I hope would happen is that the match(dataloader_iter) would trigger an StopIteration or whatever it is exception rather than returning None. The StopIteration exception ideally would raise through this function (what happens now on the match) and be handled elsewhere. So I think your case _ should never get hit...
There was a problem hiding this comment.
Maybe a better error message on line 84 would be "None batch returned at the end of iteration rather than a StopIteration exception being raised, why?"
There was a problem hiding this comment.
So I only added this to be past the linter. I updated the comment so that its more accurate. My only concern would be how it plays out with drop_last=True since maybe that would dump some None's?
than just dictionaries Signed-off-by: Jonathan Mitchell <jomitchell@nvidia.com>
14c5733 to
5971ff5
Compare
…variety of tensors (#9641) * enables default data step in megatron parallel to operate on a wider variety of tensors coming out of the dataloader * handles the case where a batch is empty * Apply isort and black reformatting Signed-off-by: jomitchellnv <jomitchellnv@users.noreply.github.com> * Allows the default data step to operate on more types than just dictionaries Signed-off-by: Jonathan Mitchell <jomitchell@nvidia.com> --------- Signed-off-by: jomitchellnv <jomitchellnv@users.noreply.github.com> Signed-off-by: Jonathan Mitchell <jomitchell@nvidia.com> Co-authored-by: jomitchellnv <jomitchellnv@users.noreply.github.com> Co-authored-by: Marc Romeyn <mromeijn@nvidia.com>
…variety of tensors (#9641) * enables default data step in megatron parallel to operate on a wider variety of tensors coming out of the dataloader * handles the case where a batch is empty * Apply isort and black reformatting Signed-off-by: jomitchellnv <jomitchellnv@users.noreply.github.com> * Allows the default data step to operate on more types than just dictionaries Signed-off-by: Jonathan Mitchell <jomitchell@nvidia.com> --------- Signed-off-by: jomitchellnv <jomitchellnv@users.noreply.github.com> Signed-off-by: Jonathan Mitchell <jomitchell@nvidia.com> Co-authored-by: jomitchellnv <jomitchellnv@users.noreply.github.com> Co-authored-by: Marc Romeyn <mromeijn@nvidia.com>
…variety of tensors (#9641) * enables default data step in megatron parallel to operate on a wider variety of tensors coming out of the dataloader * handles the case where a batch is empty * Apply isort and black reformatting Signed-off-by: jomitchellnv <jomitchellnv@users.noreply.github.com> * Allows the default data step to operate on more types than just dictionaries Signed-off-by: Jonathan Mitchell <jomitchell@nvidia.com> --------- Signed-off-by: jomitchellnv <jomitchellnv@users.noreply.github.com> Signed-off-by: Jonathan Mitchell <jomitchell@nvidia.com> Co-authored-by: jomitchellnv <jomitchellnv@users.noreply.github.com> Co-authored-by: Marc Romeyn <mromeijn@nvidia.com>
…variety of tensors (#9641) * enables default data step in megatron parallel to operate on a wider variety of tensors coming out of the dataloader * handles the case where a batch is empty * Apply isort and black reformatting Signed-off-by: jomitchellnv <jomitchellnv@users.noreply.github.com> * Allows the default data step to operate on more types than just dictionaries Signed-off-by: Jonathan Mitchell <jomitchell@nvidia.com> --------- Signed-off-by: jomitchellnv <jomitchellnv@users.noreply.github.com> Signed-off-by: Jonathan Mitchell <jomitchell@nvidia.com> Co-authored-by: jomitchellnv <jomitchellnv@users.noreply.github.com> Co-authored-by: Marc Romeyn <mromeijn@nvidia.com> Signed-off-by: Tugrul Konuk <ertkonuk@gmail.com>
…variety of tensors (NVIDIA-NeMo#9641) * enables default data step in megatron parallel to operate on a wider variety of tensors coming out of the dataloader * handles the case where a batch is empty * Apply isort and black reformatting Signed-off-by: jomitchellnv <jomitchellnv@users.noreply.github.com> * Allows the default data step to operate on more types than just dictionaries Signed-off-by: Jonathan Mitchell <jomitchell@nvidia.com> --------- Signed-off-by: jomitchellnv <jomitchellnv@users.noreply.github.com> Signed-off-by: Jonathan Mitchell <jomitchell@nvidia.com> Co-authored-by: jomitchellnv <jomitchellnv@users.noreply.github.com> Co-authored-by: Marc Romeyn <mromeijn@nvidia.com> Signed-off-by: tonyjie <jl4257@cornell.edu>
…variety of tensors (#9641) * enables default data step in megatron parallel to operate on a wider variety of tensors coming out of the dataloader * handles the case where a batch is empty * Apply isort and black reformatting Signed-off-by: jomitchellnv <jomitchellnv@users.noreply.github.com> * Allows the default data step to operate on more types than just dictionaries Signed-off-by: Jonathan Mitchell <jomitchell@nvidia.com> --------- Signed-off-by: jomitchellnv <jomitchellnv@users.noreply.github.com> Signed-off-by: Jonathan Mitchell <jomitchell@nvidia.com> Co-authored-by: jomitchellnv <jomitchellnv@users.noreply.github.com> Co-authored-by: Marc Romeyn <mromeijn@nvidia.com>
…variety of tensors (NVIDIA-NeMo#9641) * enables default data step in megatron parallel to operate on a wider variety of tensors coming out of the dataloader * handles the case where a batch is empty * Apply isort and black reformatting Signed-off-by: jomitchellnv <jomitchellnv@users.noreply.github.com> * Allows the default data step to operate on more types than just dictionaries Signed-off-by: Jonathan Mitchell <jomitchell@nvidia.com> --------- Signed-off-by: jomitchellnv <jomitchellnv@users.noreply.github.com> Signed-off-by: Jonathan Mitchell <jomitchell@nvidia.com> Co-authored-by: jomitchellnv <jomitchellnv@users.noreply.github.com> Co-authored-by: Marc Romeyn <mromeijn@nvidia.com> Signed-off-by: Hainan Xu <hainanx@nvidia.com>
…variety of tensors (NVIDIA-NeMo#9641) * enables default data step in megatron parallel to operate on a wider variety of tensors coming out of the dataloader * handles the case where a batch is empty * Apply isort and black reformatting Signed-off-by: jomitchellnv <jomitchellnv@users.noreply.github.com> * Allows the default data step to operate on more types than just dictionaries Signed-off-by: Jonathan Mitchell <jomitchell@nvidia.com> --------- Signed-off-by: jomitchellnv <jomitchellnv@users.noreply.github.com> Signed-off-by: Jonathan Mitchell <jomitchell@nvidia.com> Co-authored-by: jomitchellnv <jomitchellnv@users.noreply.github.com> Co-authored-by: Marc Romeyn <mromeijn@nvidia.com>
…variety of tensors coming out of the dataloader
Add more flexibility to the default data step inside megatron parallel.
Add a one line overview of what this PR aims to accomplish.
Collection: [Note which collection this PR will affect]
Changelog
Usage
# Add a code snippet demonstrating how to use thisGitHub 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:
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