Skip to content

[FA] Fix FA tests for unique models - #50632

Open
vasqu wants to merge 4 commits into
mainfrom
fix-fa-for-some
Open

vasqu wants to merge 4 commits into
mainfrom
fix-fa-for-some

Conversation

@vasqu

@vasqu vasqu commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

🤗 Transformers CI

As per title

@github-actions

Copy link
Copy Markdown
Contributor

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

run-slow: bamba, bark, clipseg, efficientloftr, falcon, higgs_audio_v2_tokenizer, idefics2, mimi, nemotron3_5_transcribe, squeezebert

@vasqu

vasqu commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator Author

run-slow: bamba, bark, clipseg, efficientloftr, falcon, higgs_audio_v2_tokenizer, idefics2, mimi, nemotron3_5_transcribe, squeezebert

# Beware that with flash_attn<2.1, using q_seqlen != k_seqlen (except for the case q_seqlen == 1) produces a wrong mask (top-left).
self._flash_attn_uses_top_left_mask = flash_attn_supports_top_left_mask()

def _split_heads(self, tensor, num_heads, attn_head_size):

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was an actual error and the shape was destroying cache updates


def _test_attention_implementation(self, attn_implementation):
"""Audio encoder can produce fp32 (attention) outputs => avoid by autocasting"""
with torch.autocast(device_type=torch_device, dtype=torch.float16):

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opted for autocast for now but maybe in the end it would be best to fix it in modeling directly cc @eustlb

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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
Copy Markdown
Contributor

CI (Nvidia + AMD)

Nvidia · ✅ No new failures 🎉👏 · ⚙️ Workflow · 📊 Dashboard

Failures (5 pre-existing)

    Pre-existing failures (still failing) — 5 total:

        Same error (5):

        - bamba:
            tests/models/bamba/test_modeling_bamba.py::BambaModelIntegrationTest::test_simple_batched_generate_with_padding
            tests/models/bamba/test_modeling_bamba.py::BambaModelIntegrationTest::test_simple_generate

        - falcon:
            tests/models/falcon/test_modeling_falcon.py::FalconLanguageGenerationTest::test_falcon_alibi_sdpa_matches_eager

        - mimi:
            tests/models/mimi/test_modeling_mimi.py::MimiIntegrationTest::test_integration
            tests/models/mimi/test_modeling_mimi.py::MimiIntegrationTest::test_integration_longform

AMD · ✅ No new failures 🎉👏 · ⚙️ Workflow · 📊 Dashboard

Failures (9 pre-existing)

    Pre-existing failures (still failing) — 9 total:

        Same error (9):

        - bamba:
            tests/models/bamba/test_modeling_bamba.py::BambaModelIntegrationTest::test_simple_batched_generate_with_padding

        - efficientloftr:
            tests/models/efficientloftr/test_modeling_efficientloftr.py::EfficientLoFTRModelTest::test_sdpa_can_compile_dynamic

        - falcon:
            tests/models/falcon/test_modeling_falcon.py::FalconModelTest::test_flash_attn_2_fp32_ln
            tests/models/falcon/test_modeling_falcon.py::FalconLanguageGenerationTest::test_falcon_alibi_sdpa_matches_eager

        - mimi:
            tests/models/mimi/test_modeling_mimi.py::MimiIntegrationTest::test_integration
            tests/models/mimi/test_modeling_mimi.py::MimiIntegrationTest::test_integration_longform

        - nemotron3_5_transcribe:
            tests/models/nemotron3_5_transcribe/test_modeling_nemotron3_5_transcribe.py::Nemotron3_5TranscribeForConditionalGenerationIntegrationTest::test_batched_transcription
            tests/models/nemotron3_5_transcribe/test_modeling_nemotron3_5_transcribe.py::Nemotron3_5TranscribeForConditionalGenerationIntegrationTest::test_speaker_attributed_transcription
            tests/models/nemotron3_5_transcribe/test_modeling_nemotron3_5_transcribe.py::Nemotron3_5TranscribeForConditionalGenerationIntegrationTest::test_word_timestamps

def test_flash_attn_2_inference_equivalence(self):
for model_class in self.all_model_classes:
if not model_class._supports_flash_attn:
self.skipTest(f"{model_class.__name__} does not support Flash Attention 2")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are looping all_model_classes and doign a skip inside, which exits the whole test. If the intent is to skip only unsupported classes, filtering the classes or using subTest() would work better

This branch has not been deployed

No deployments
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