Repository navigation
Conversation
This was referenced Nov 9, 2026
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
3outeille
force-pushed
the
cp-7-auto-pad
branch
from
November 9, 2026 14:37
4249c6d to
043fd08
Compare
This was referenced Nov 9, 2026
3outeille
force-pushed
the
cp-7-auto-pad
branch
from
November 10, 2026 02:51
043fd08 to
274c694
Compare
3outeille
force-pushed
the
cp-7-auto-pad
branch
from
November 10, 2026 03:01
274c694 to
a5d8617
Compare
3outeille
force-pushed
the
cp-7-auto-pad
branch
from
November 10, 2026 05:19
a5d8617 to
ed0c679
Compare
3outeille
force-pushed
the
cp-7-auto-pad
branch
from
November 10, 2026 05:45
ed0c679 to
0473203
Compare
3outeille
force-pushed
the
cp-7-auto-pad
branch
2 times, most recently
from
November 12, 2026 06:19
811cfea to
dca9b1c
Compare
3outeille
force-pushed
the
cp-7-auto-pad
branch
from
November 12, 2026 07:15
dca9b1c to
df47b56
Compare
… cp_size The root pre-hook pads every sequence-shaped input at its end instead of raising: `input_ids` with the model's `pad_token_id` (0 without one), `inputs_embeds` with zeros, `position_ids` with the positions that continue each row's last document, a 2D `attention_mask` with zeros, and `labels` or a caller's `shift_labels` with -100. The padding happens before the model builds its mask and its rotary embeddings, so nothing on the padding is attended to or trained on, and the loss wrapper counts `num_items_in_batch` on the real tokens only.
…vide A length of 7 over 2 ranks (plain, packed, `inputs_embeds` and through a 2D padding mask) and a length of 5 over 4 ranks, compared on the real positions of the logits only, plus a single-process test of the hook's padding of every input, of a positional `input_ids` and of a config without a `pad_token_id`.
3outeille
force-pushed
the
cp-7-auto-pad
branch
from
November 12, 2026 08:01
df47b56 to
ed345b3
Compare
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.
What does this PR do?
Stack: #50493 → #50496 → #50511 → #50514 → this PR → #50499 → #50521 → #50522
With context parallelism, a sequence length that
cp_sizedoes not divide used to raise. NowModelContextParallel, the style of the model itself (#50493), pads the full sequences at the end, before the model builds its masks:input_idsgetpad_token_id(or 0), andinputs_embedsget zeros. No real token attends to the padding, because it comes after them.position_ids, if given, continue those of the last document.attention_mask, if given, gets zeros.labelsandshift_labelsget -100, sonum_items_in_batchstill counts the real tokens only.outputs.logitsis this rank's slice of the padded sequence.Tests
tests/context_parallel, CPU (gloo):inputs_embeds, with a padding mask) and length 5 with cp=4;ModelContextParallelpads.