[NeMo-UX] Make TE and Apex dependencies optional#9550
Conversation
nemo/lightning/apex_utils.py
Outdated
| # def check_adlr_autoresume_termination(iteration, model, optimizer, lr_scheduler, save: bool): | ||
| # """Check for autoresume signal and exit if it is received.""" | ||
| # from apex.ppu.checkpointing import save_checkpoint | ||
| # | ||
| # autoresume = get_adlr_autoresume() | ||
| # # Add barrier to ensure consistency. | ||
| # torch.distributed.barrier() | ||
| # if autoresume.termination_requested(): | ||
| # if save: | ||
| # save_checkpoint(iteration, model, optimizer, lr_scheduler) | ||
| # print_rank_0(">>> autoresume termination request found!") | ||
| # if torch.distributed.get_rank() == 0: | ||
| # autoresume.request_resume() | ||
| # print_rank_0(">>> training terminated. Returning") | ||
| # sys.exit(0) |
Check notice
Code scanning / CodeQL
Commented-out code
| HAVE_MEGATRON_CORE = False | ||
| from typing import Any | ||
|
|
||
| RetroConfig = Any |
There was a problem hiding this comment.
do we want to do the same for all of others mcore's classes we are trying to import under "try" block?
also, why don't use ApexGuardDefaults?
There was a problem hiding this comment.
do we want to do the same for all of others mcore's classes we are trying to import under "try" block?
So this PR is intended to provide a pure pytorch/jit path for NeMo 2.0, so things are not guaranteed to work with NeMo 1.0 models (I have updated the description to reflect this). I added this change because previously, the import of the Retro model in https://github.com/NVIDIA/NeMo/blob/bdb4e89d9ac33d733f8ea7b21552628dda798825/nemo/collections/nlp/models/language_modeling/__init__.py was breaking the 2.0 codepath, but it looks like that's no longer the case anymore. If it makes things clearer, I go ahead and revert this change.
nemo/lightning/data.py
Outdated
| setup_microbatch_calculator, | ||
| ) | ||
|
|
||
| HAVE_APEX = True |
Check notice
Code scanning / CodeQL
Unused local variable
ed46aec to
9e0fbbd
Compare
6f3f671 to
6abeff6
Compare
Signed-off-by: ashors1 <ashors@nvidia.com>
Signed-off-by: ashors1 <ashors1@users.noreply.github.com>
Signed-off-by: ashors1 <ashors@nvidia.com>
Signed-off-by: ashors1 <ashors@nvidia.com>
Signed-off-by: ashors1 <ashors1@users.noreply.github.com>
Signed-off-by: ashors1 <ashors@nvidia.com>
Signed-off-by: ashors1 <ashors@nvidia.com>
Signed-off-by: ashors1 <ashors@nvidia.com>
Signed-off-by: ashors1 <ashors1@users.noreply.github.com>
Signed-off-by: ashors1 <ashors@nvidia.com>
Signed-off-by: ashors1 <ashors@nvidia.com>
Signed-off-by: ashors1 <ashors1@users.noreply.github.com>
…ore RETRO MLM Signed-off-by: huvunvidia <86480512+huvunvidia@users.noreply.github.com>
Signed-off-by: huvunvidia <huvunvidia@users.noreply.github.com>
Signed-off-by: ashors1 <ashors1@users.noreply.github.com>
…nto ashors/remove-te-apex-deps
Signed-off-by: ashors1 <ashors@nvidia.com>
Signed-off-by: ashors1 <ashors@nvidia.com>
Signed-off-by: ashors1 <ashors@nvidia.com>
Signed-off-by: ashors1 <ashors@nvidia.com>
Signed-off-by: ashors1 <ashors1@users.noreply.github.com>
What does this PR do ?
This PR provides a fallback codepath that defaults to pure Pytorch/jit when TE and Apex are not installed. Note that this is specifically designed to work with NeMo 2.0, so there are no guarantees when running with NeMo 1.0 models.
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