collator: reject THD CP shards with non-divisible padded lengths - #1765
Open
andrewstellman wants to merge 1 commit into
Open
andrewstellman wants to merge 1 commit into
andrewstellman wants to merge 1 commit into
Conversation
The THD branch of _split_batch_by_cp_rank floor-divides each padded sequence length by 2 * cp_world_size, so a length that is not a multiple loses its remainder tokens from every CP rank's shard. Raise ValueError, as the BSHD branch already does. Copies regenerated with check_copied_files.py --fix.
Contributor
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: NVIDIA-BioNeMo/bionemo-recipes/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
andrewstellman
marked this pull request as ready for review
September 29, 2026 18:39
andrewstellman
requested review from
jstjohn,
jwilber,
pstjohn,
savitha-eng and
trvachov
as code owners
September 29, 2026 18:39
Collaborator
|
Thanks for this contribution! @pstjohn @jomitchellnv can you both review? |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The THD branch of
_split_batch_by_cp_rankfloor-divides each padded sequence length by2 * cp_world_sizewithout checking that the division is exact, so the remainder tokens reach no rank. For example, withcu_seqlens_padded = [0, 8, 18]andcp_world_size = 2, positions 16 and 17 are in neither rank's shard. The BSHD branch already raises for this; this adds the same check to THD.The shipped CP configs are unaffected: they pad to a multiple of
2 * cp_size. This only fires whenpad_sequences_to_be_divisible_byis overridden to a value that isn't, and such a run now fails on the first affected batch instead of dropping tokens. Like the BSHD check, it raises on CP rank 0 and the other ranks wait for the process-group timeout. A config-time check is an alternative if you'd prefer one.The eight copies were regenerated with
ci/scripts/check_copied_files.py --fix.Found by Quality Playbook, an AI code-review tool, with Claude; I reviewed the change.
Usage
No interface change.
Type of changes
CI Pipeline Configuration
No extra labels requested.
Pre-submit Checklist
collator.pyimportstransformer_engine.