[NeMo-UX] Support `load_strictness`
State: closed | Pull request: yes
Labels: name: Run CICD

# What does this PR do ?

Add a one line overview of what this PR aims to accomplish.

**Collection**: llm

# Changelog 
- Add specific line by line info of high level changes in this PR.

# Usage
* You can potentially add a usage example below

```python
# 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](https://github.com/NVIDIA/NeMo/blob/main/CONTRIBUTING.md)
- [ ] 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](https://github.com/NVIDIA/NeMo/blob/main/CONTRIBUTING.md) contains specific people who can review PRs to various areas.

# Additional Information
* Related to # (issue)


> PL does this like [this](https://github.com/Lightning-AI/pytorch-lightning/pull/19404/files#diff-72f5c7707bc8f4033f0e5f644a8b2eda5d333084e91dfeaaa1368dcbdf24df02). So I feel like we should adopt the same design and not add a custom arg to our strategy.

If only we can propagate this flag to dist_checkpointing.load then using this flag would be ideal

> > PL does this like [this](https://github.com/Lightning-AI/pytorch-lightning/pull/19404/files#diff-72f5c7707bc8f4033f0e5f644a8b2eda5d333084e91dfeaaa1368dcbdf24df02). So I feel like we should adopt the same design and not add a custom arg to our strategy.
> 
> If only we can propagate this flag to dist_checkpointing.load then using this flag would be ideal

Yeah, an example of how PL does that can be found [here](https://github.com/Lightning-AI/pytorch-lightning/blob/b35f303561e0de06d559c9ec5322ffaa1a9017c0/src/lightning/pytorch/strategies/fsdp.py#L609).

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.

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

> > If only we can propagate this flag to dist_checkpointing.load then using this flag would be ideal
> 
> Yeah, an example of how PL does that can be found [here](https://github.com/Lightning-AI/pytorch-lightning/blob/b35f303561e0de06d559c9ec5322ffaa1a9017c0/src/lightning/pytorch/strategies/fsdp.py#L609).

Revisiting this PR. I don't think this is quite what we want. It looks like PTL's `strict` is just passed to `load_model_state_dict`, which is called after the checkpoint is loaded using `dist_checkpointing.load`, so we're not able to propagate the value of `strict` to `dist_checkpointing.load`

<!-- pylint-output-strict-mode-false -->

beep boop 🤖: 🙏 The following files have warnings. In case you are familiar with these, please try helping us to improve the code base.

---

Your code was analyzed with PyLint. The following annotations have been identified:

```
************* Module nemo.lightning._strategy_lib
nemo/lightning/_strategy_lib.py:573:0: C0301: Line too long (130/119) (line-too-long)
nemo/lightning/_strategy_lib.py:35:0: C0115: Missing class docstring (missing-class-docstring)
nemo/lightning/_strategy_lib.py:36:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/_strategy_lib.py:139:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/_strategy_lib.py:166:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/_strategy_lib.py:202:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/_strategy_lib.py:515:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/_strategy_lib.py:598:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/_strategy_lib.py:611:4: C0115: Missing class docstring (missing-class-docstring)
************* Module nemo.lightning.io.pl
nemo/lightning/io/pl.py:82:0: C0301: Line too long (130/119) (line-too-long)
nemo/lightning/io/pl.py:58:0: C0115: Missing class docstring (missing-class-docstring)
nemo/lightning/io/pl.py:64:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/io/pl.py:73:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/io/pl.py:303:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/io/pl.py:308:4: C0116: Missing function or method docstring (missing-function-docstring)
************* Module nemo.lightning.pytorch.callbacks.peft
nemo/lightning/pytorch/callbacks/peft.py:381:0: C0301: Line too long (130/119) (line-too-long)
nemo/lightning/pytorch/callbacks/peft.py:207:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/callbacks/peft.py:324:0: C0115: Missing class docstring (missing-class-docstring)
************* Module nemo.lightning.pytorch.strategies.megatron_strategy
nemo/lightning/pytorch/strategies/megatron_strategy.py:315:0: C0301: Line too long (159/119) (line-too-long)
nemo/lightning/pytorch/strategies/megatron_strategy.py:90:0: C0115: Missing class docstring (missing-class-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:272:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:305:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:386:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:396:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:402:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:445:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:449:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:481:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:491:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:558:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:577:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:604:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:612:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:620:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:624:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:663:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:684:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:719:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:742:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:751:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:759:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:771:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:801:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:826:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:842:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:60:0: W0611: Unused _ModuleStepFunction imported from nemo.lightning.megatron_parallel (unused-import)
nemo/lightning/pytorch/strategies/megatron_strategy.py:76:0: W0611: Unused AdapterPath imported from nemo.lightning.resume (unused-import)

-----------------------------------
Your code has been rated at 9.52/10
```

---

Thank you for improving NeMo's documentation!

<!-- pylint-output-strict-mode-false -->

beep boop 🤖: 🙏 The following files have warnings. In case you are familiar with these, please try helping us to improve the code base.

---

Your code was analyzed with PyLint. The following annotations have been identified:

```
************* Module nemo.lightning._strategy_lib
nemo/lightning/_strategy_lib.py:573:0: C0301: Line too long (130/119) (line-too-long)
nemo/lightning/_strategy_lib.py:35:0: C0115: Missing class docstring (missing-class-docstring)
nemo/lightning/_strategy_lib.py:36:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/_strategy_lib.py:139:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/_strategy_lib.py:166:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/_strategy_lib.py:202:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/_strategy_lib.py:515:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/_strategy_lib.py:598:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/_strategy_lib.py:611:4: C0115: Missing class docstring (missing-class-docstring)
************* Module nemo.lightning.io.pl
nemo/lightning/io/pl.py:82:0: C0301: Line too long (130/119) (line-too-long)
nemo/lightning/io/pl.py:58:0: C0115: Missing class docstring (missing-class-docstring)
nemo/lightning/io/pl.py:64:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/io/pl.py:73:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/io/pl.py:303:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/io/pl.py:308:4: C0116: Missing function or method docstring (missing-function-docstring)
************* Module nemo.lightning.pytorch.callbacks.peft
nemo/lightning/pytorch/callbacks/peft.py:381:0: C0301: Line too long (130/119) (line-too-long)
nemo/lightning/pytorch/callbacks/peft.py:207:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/callbacks/peft.py:324:0: C0115: Missing class docstring (missing-class-docstring)
************* Module nemo.lightning.pytorch.strategies.megatron_strategy
nemo/lightning/pytorch/strategies/megatron_strategy.py:315:0: C0301: Line too long (159/119) (line-too-long)
nemo/lightning/pytorch/strategies/megatron_strategy.py:90:0: C0115: Missing class docstring (missing-class-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:272:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:305:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:386:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:396:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:402:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:445:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:449:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:481:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:491:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:558:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:577:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:604:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:612:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:620:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:624:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:663:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:684:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:719:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:742:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:751:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:759:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:771:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:801:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:826:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:842:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/megatron_strategy.py:60:0: W0611: Unused _ModuleStepFunction imported from nemo.lightning.megatron_parallel (unused-import)
nemo/lightning/pytorch/strategies/megatron_strategy.py:76:0: W0611: Unused AdapterPath imported from nemo.lightning.resume (unused-import)

-----------------------------------
Your code has been rated at 9.52/10
```

---

Thank you for improving NeMo's documentation!

[🤖]: Hi @ashors1 👋,

We wanted to let you know that a [CICD pipeline](https://github.com/NVIDIA/NeMo/actions/runs/12032526801) for this PR just finished successfully

So it might be time to merge this PR or get some approvals

I'm just a bot so I'll leave it you what to do next.

//cc @pablo-garay @ko3n1g