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: regular torch optims (e.g., sgd) no longer error with closure spec #11189

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

terrykong
Copy link
Collaborator

@terrykong terrykong commented Nov 6, 2024

What does this PR do ?

Mcore distributed optimizers now require us to specify the closure kwarg. Example:
https://github.com/NVIDIA/NeMo-Aligner/blob/ac97fe334eff9ad3177edf274c011e74d14a4d60/nemo_aligner/algorithms/dpo.py#L202

This means that if the application also specifies None for closure, we'll error b/c closure is passed twice. This change pops off closure and ensures it is None to be compliant.

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)

@github-actions github-actions bot added core Changes to NeMo Core NLP common labels Nov 6, 2024
@terrykong terrykong closed this Nov 6, 2024
@terrykong terrykong force-pushed the terryk/allow-optim-closure-repeat branch from 3c8e5c9 to 90d82dc Compare November 6, 2024 18:23
@terrykong terrykong reopened this Nov 6, 2024
@terrykong terrykong changed the title Terryk/allow optim closure repeat fix: regular torch optims (e.g., sgd) no longer error with closure spec Nov 6, 2024
@terrykong terrykong marked this pull request as ready for review November 6, 2024 18:27
@terrykong terrykong force-pushed the terryk/allow-optim-closure-repeat branch from a559083 to ba8edbd Compare November 6, 2024 22:39
terrykong added a commit to NVIDIA/NeMo-Aligner that referenced this pull request Nov 6, 2024
terrykong added a commit to NVIDIA/NeMo-Aligner that referenced this pull request Nov 7, 2024
- Needed for sequence parallel where the sequence length needs to be
  divisible

Signed-off-by: Terry Kong <[email protected]>

missing plumbing

Signed-off-by: Terry Kong <[email protected]>

fix: update other APIs required for MCore dist opt

Signed-off-by: Terry Kong <[email protected]>

feat: more informative error for DPO dataset tokenization failure

Signed-off-by: Terry Kong <[email protected]>

more functional tests

Signed-off-by: Terry Kong <[email protected]>

rename

Signed-off-by: Terry Kong <[email protected]>

convenience script to run all functional tests

Signed-off-by: Terry Kong <[email protected]>

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Signed-off-by: NeMo-Aligner CI <[email protected]>

more

Signed-off-by: Terry Kong <[email protected]>

fix closure, but need NVIDIA/NeMo#11189

Signed-off-by: Terry Kong <[email protected]>

eosid -> -100

Signed-off-by: Terry Kong <[email protected]>

revert black

Signed-off-by: Terry Kong <[email protected]>

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Signed-off-by: NeMo-Aligner CI <[email protected]>

global pad

Signed-off-by: Terry Kong <[email protected]>

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Signed-off-by: NeMo-Aligner CI <[email protected]>

test cleanup

Signed-off-by: Terry Kong <[email protected]>

make all scripts output the same

Signed-off-by: Terry Kong <[email protected]>

license

Signed-off-by: Terry Kong <[email protected]>

more comment

Signed-off-by: Terry Kong <[email protected]>
terrykong added a commit to NVIDIA/NeMo-Aligner that referenced this pull request Nov 7, 2024
- Needed for sequence parallel where the sequence length needs to be
  divisible

Signed-off-by: Terry Kong <[email protected]>

missing plumbing

Signed-off-by: Terry Kong <[email protected]>

fix: update other APIs required for MCore dist opt

Signed-off-by: Terry Kong <[email protected]>

feat: more informative error for DPO dataset tokenization failure

Signed-off-by: Terry Kong <[email protected]>

more functional tests

Signed-off-by: Terry Kong <[email protected]>

rename

Signed-off-by: Terry Kong <[email protected]>

convenience script to run all functional tests

Signed-off-by: Terry Kong <[email protected]>

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Signed-off-by: NeMo-Aligner CI <[email protected]>

more

Signed-off-by: Terry Kong <[email protected]>

fix closure, but need NVIDIA/NeMo#11189

Signed-off-by: Terry Kong <[email protected]>

eosid -> -100

Signed-off-by: Terry Kong <[email protected]>

revert black

Signed-off-by: Terry Kong <[email protected]>

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Signed-off-by: NeMo-Aligner CI <[email protected]>

global pad

Signed-off-by: Terry Kong <[email protected]>

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Signed-off-by: NeMo-Aligner CI <[email protected]>

test cleanup

Signed-off-by: Terry Kong <[email protected]>

make all scripts output the same

Signed-off-by: Terry Kong <[email protected]>

license

Signed-off-by: Terry Kong <[email protected]>

more comment

Signed-off-by: Terry Kong <[email protected]>
terrykong added a commit to NVIDIA/NeMo-Aligner that referenced this pull request Nov 7, 2024
- Needed for sequence parallel where the sequence length needs to be
  divisible

Signed-off-by: Terry Kong <[email protected]>

missing plumbing

Signed-off-by: Terry Kong <[email protected]>

fix: update other APIs required for MCore dist opt

Signed-off-by: Terry Kong <[email protected]>

feat: more informative error for DPO dataset tokenization failure

Signed-off-by: Terry Kong <[email protected]>

more functional tests

Signed-off-by: Terry Kong <[email protected]>

rename

Signed-off-by: Terry Kong <[email protected]>

convenience script to run all functional tests

Signed-off-by: Terry Kong <[email protected]>

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Signed-off-by: NeMo-Aligner CI <[email protected]>

more

Signed-off-by: Terry Kong <[email protected]>

fix closure, but need NVIDIA/NeMo#11189

Signed-off-by: Terry Kong <[email protected]>

eosid -> -100

Signed-off-by: Terry Kong <[email protected]>

revert black

Signed-off-by: Terry Kong <[email protected]>

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Signed-off-by: NeMo-Aligner CI <[email protected]>

global pad

Signed-off-by: Terry Kong <[email protected]>

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Signed-off-by: NeMo-Aligner CI <[email protected]>

test cleanup

Signed-off-by: Terry Kong <[email protected]>

make all scripts output the same

Signed-off-by: Terry Kong <[email protected]>

license

Signed-off-by: Terry Kong <[email protected]>

more comment

Signed-off-by: Terry Kong <[email protected]>

license and fix sft

Signed-off-by: Terry Kong <[email protected]>

sft torchrun -> mpirun

Signed-off-by: Terry Kong <[email protected]>

guard nonsense padding

Signed-off-by: Terry Kong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Changes to NeMo Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant