Skip to content

Mask vocab padding token ids from CE loss#11999

Merged
maanug-nv merged 2 commits intomainfrom
maanug/mask-vocab-padding
Jan 31, 2025
Merged

Mask vocab padding token ids from CE loss#11999
maanug-nv merged 2 commits intomainfrom
maanug/mask-vocab-padding

Conversation

@maanug-nv
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)

Signed-off-by: Maanu Grover <maanug@nvidia.com>
Signed-off-by: Maanu Grover <maanug@nvidia.com>
@maanug-nv maanug-nv force-pushed the maanug/mask-vocab-padding branch from 664da0b to 55e5c55 Compare January 31, 2025 00:59
@maanug-nv maanug-nv marked this pull request as ready for review January 31, 2025 01:00
@github-actions
Copy link
Contributor

[🤖]: Hi @maanug-nv 👋,

We wanted to let you know that a CICD pipeline 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

Copy link
Collaborator

@suiyoubi suiyoubi left a comment

Choose a reason for hiding this comment

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

Thanks for adding this. LGTM

Copy link
Contributor

@sichu2023 sichu2023 left a comment

Choose a reason for hiding this comment

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

LGTM.

vocab_start_index, _ = get_vocab_range(padded_vocab_size, rank, world_size) # gets range on this tp rank

# mask tokens past unpadded_vocab_size. must be offset by where each tp rank's vocab range starts
mask_start = max(unpadded_vocab_size - vocab_start_index, 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice.

@maanug-nv maanug-nv merged commit 241e1f0 into main Jan 31, 2025
210 of 212 checks passed
@maanug-nv maanug-nv deleted the maanug/mask-vocab-padding branch January 31, 2025 20:24
BoxiangW pushed a commit that referenced this pull request Feb 7, 2025
* mask padding tokens in vocab from softmax

Signed-off-by: Maanu Grover <maanug@nvidia.com>

* comments and disable by default

Signed-off-by: Maanu Grover <maanug@nvidia.com>

---------

Signed-off-by: Maanu Grover <maanug@nvidia.com>
youngeunkwon0405 pushed a commit to youngeunkwon0405/NeMo that referenced this pull request Feb 10, 2025
* mask padding tokens in vocab from softmax

Signed-off-by: Maanu Grover <maanug@nvidia.com>

* comments and disable by default

Signed-off-by: Maanu Grover <maanug@nvidia.com>

---------

Signed-off-by: Maanu Grover <maanug@nvidia.com>
Signed-off-by: Youngeun Kwon <youngeunk@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.

3 participants