Skip to content

Conversation

@Abdennacer-Badaoui
Copy link
Member

What does this PR do?

Fixes Flash Attention 2 generation with left-padding in GPT-2 by ensuring is_causal=True is set even when padding masks are provided.

Flash Attention 2 handles causal masking and padding independently, but the original code incorrectly disabled causal masking when any attention mask was present.

Fixes: test_flash_attn_2_generate_padding_left

@Abdennacer-Badaoui Abdennacer-Badaoui force-pushed the fix/test_flash_attn_2_generate_padding_left branch from 2877ab9 to 4f20a1f Compare October 31, 2025 15:13
@HuggingFaceDocBuilderDev

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.

@github-actions
Copy link
Contributor

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

run-slow: decision_transformer, gpt2

@Abdennacer-Badaoui
Copy link
Member Author

@vasqu , ready for review :)

@remi-or remi-or requested review from Cyrilvallez and vasqu and removed request for Cyrilvallez November 3, 2025 14:00
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.

2 participants