fix(gpt-oss): route packed attention through THD#3226
Draft
akoumpa wants to merge 1 commit into
Draft
Conversation
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Contributor
Author
|
/ok to test f915978 |
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.
Summary
cu_seqlensmetadata whenqkv_formatis not explicitly set.qkv_format=thdand clearing the padding mask before backend preprocessing.Root Cause
The packed recipe passed THD metadata through
cu_seqlens, butGptOssForCausalLM.forwardonly treated the input as packed whenattn_kwargs["qkv_format"] == "thd". That left TE preprocessing able to route flattened packed tensors through the BSHD path, which produced the runtime assertion from AMINT-28:Queries, keys and values must be 4D tensors when qkv_format='bshd'.Validation
python -m pytest tests/unit_tests/models/gpt_oss/test_gptoss_model.py tests/unit_tests/models/gpt_oss/test_gptoss_layers.py tests/unit_tests/attention/test_attention_utils.py -q(57 passed, 16 skipped)python -m ruff check nemo_automodel/components/models/gpt_oss/layers.py nemo_automodel/components/models/gpt_oss/model.py tests/unit_tests/models/gpt_oss/test_gptoss_model.pypython -m ruff format --check nemo_automodel/components/models/gpt_oss/layers.py nemo_automodel/components/models/gpt_oss/model.py tests/unit_tests/models/gpt_oss/test_gptoss_model.py && git diff --checkNote: the successful Nemo-CI run used the x86 EOS/H100 lane and
INSTALL_FA3=falseto bypass unrelated pre-testflash_attn_3container build failures observed in earlier attempts.