Repository navigation
Pass Whisper decoder position_ids from cache_position - #24850
Conversation
transformers 5.11 ignores cache_position in WhisperDecoder and computes
position_ids as arange(T) + get_seq_length(). The position-embedding gather
then takes its row indices from an add, which the GGML engine rejects
("row indices must come from a graph input ..."), failing
test_ggml_runner_matches_eager on main since pytorch#23904. Passing position_ids
derived from the cache_position input keeps the indices traceable to a graph
input on both transformers 5.0.0rc1 and 5.11.
This PR was authored with Claude Code.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24850
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (7 Unrelated Failures)As of commit 002b04d with merge base 2dacff2 ( FLAKY - The following job failed but was likely due to flakiness present on trunk:
BROKEN TRUNK - The following jobs failed but was present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
|
@claude review effort:max |
|
Claude finished @JakeStevens's task in 2m 58s —— View job The fix is correct for the ggml row-index check, and I found nothing that blocks merging; there are two minor points (a misleading comment and a missing CPU-only regression test) and one low-confidence question about the sibling LLM exporter. Detailed reviewPR Review: #24850SummaryThis PR passes Not verified: none of the reviewers could read the installed transformers source, so the claims about Code Quality
Testing
Code Quality (follow-up question, low confidence)
RecommendationApprove: the fix is minimal and targeted. Fixing the comment is a nit. The CPU-only guard test and the LLM-exporter check can be done as follow-ups. |
Fixes the
native-ggmlfailure on main since #23904 (test_hf_whisper.py::WhisperNativeExportTest::test_ggml_runner_matches_eager):#24422 bumped transformers from 5.0.0rc1 to 5.11.0. In 5.11,
WhisperDecoder.forwardignorescache_positionand computesposition_ids = arange(T) + past_key_values.get_seq_length(), so the position-embeddingaten.index.Tensortakes its indices from anaten.add, whichGraphBuilder::check_row_indicesrejects. The exporter already routed the self-attention cache writes throughcache_position(PositionedStaticLayer). This change does the same for the position embeddings by passingposition_ids=cache_position.unsqueeze(0).Test plan: exported a small random-weight Whisper decoder with transformers 5.11.0 and 5.0.0rc1 and traced every index op's indices. Before this change, under 5.11, the position-embedding gather traced to
repeat <- unsqueeze <- add. With it, the gather traces tounsqueeze <- cache_positionon both versions, and theindex_copycache writes are unchanged. Thenative-ggmljob on this PR runs the end-to-end runner test.This PR was authored with Claude Code.