Skip to content

End-to-end test of Gemma 3 + FA2 construction - #45760

Closed
jamesbraza wants to merge 2 commits into
huggingface:mainfrom
jamesbraza:test-flash-attention-sinkless
Closed

jamesbraza wants to merge 2 commits into
huggingface:mainfrom
jamesbraza:test-flash-attention-sinkless

Conversation

@jamesbraza

Copy link
Copy Markdown
Contributor

This small PR adds an end-to-end regression test for the fix in #45589 for #45588:

  1. Builds a sinkless tiny Gemma3 with FA2
  2. Runs a forward pass.

Cherry-picked from @truffle-dev's fork; verified on compute cluster with H100.

This PR adds test coverage for the fix in #45589 for #45588.

@ArthurZucker @Cyrilvallez

truffle-dev and others added 2 commits May 3, 2026 12:09
Before huggingface#45589, `flash_attention_forward` called `s_aux.to(query.dtype)`
unconditionally and raised `AttributeError` on models that do not use
attention sinks (see huggingface#45588). The fix guards the cast behind
`s_aux is not None`, but no test exercises the sinkless branch through
the real dispatcher.

Add `test_flash_attention_2_forward_on_sinkless_model` to
`Gemma3TextModelTest`, which loads the tiny-random sinkless Gemma3
fixture with `attn_implementation="flash_attention_2"` and runs a
forward pass. Guarded with `@slow`, `@require_torch_gpu`, and
`@require_flash_attn` so it only runs under `RUN_SLOW=1` with FA
installed.
Drop the issue/PR-specific narrative from the docstring in favor of a
summary describing what the test actually does — an end-to-end integration check
of model construction and a forward pass through the flash-attention backend.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: gemma3

@Cyrilvallez

Copy link
Copy Markdown
Member

Hey! This test is just running on forward on fa2, which is already tested in other integration tests! So there is no need to add it again!

@jamesbraza
jamesbraza deleted the test-flash-attention-sinkless branch May 11, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants