Skip to content

Commit

Permalink
add the missing flash attention test marker (#32419)
Browse files Browse the repository at this point in the history
* add flash attention check

* fix

* fix

* add the missing marker

* bug fix

* add one more

* remove order

* add one more
  • Loading branch information
faaany authored Aug 6, 2024
1 parent 0aa8328 commit e85d863
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/models/gemma/test_modeling_gemma.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,9 @@ def test_model_2b_sdpa(self):

self.assertEqual(output_text, EXPECTED_TEXTS)

@pytest.mark.flash_attn_test
@require_flash_attn
@require_read_token
@pytest.mark.flash_attn_test
def test_model_2b_flash_attn(self):
model_id = "google/gemma-2b"
EXPECTED_TEXTS = [
Expand Down
1 change: 1 addition & 0 deletions tests/models/llama/test_modeling_llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ def test_flash_attn_2_generate_padding_right(self):
@require_flash_attn
@require_torch_gpu
@slow
@pytest.mark.flash_attn_test
def test_use_flash_attention_2_true(self):
"""
NOTE: this is the only test testing that the legacy `use_flash_attention=2` argument still works as intended.
Expand Down
3 changes: 2 additions & 1 deletion tests/models/mistral/test_modeling_mistral.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,9 +576,10 @@ def test_model_7b_dola_generation(self):
backend_empty_cache(torch_device)
gc.collect()

@require_flash_attn
@require_bitsandbytes
@slow
@require_flash_attn
@pytest.mark.flash_attn_test
def test_model_7b_long_prompt(self):
EXPECTED_OUTPUT_TOKEN_IDS = [306, 338]
# An input with 4097 tokens that is above the size of the sliding window
Expand Down
1 change: 1 addition & 0 deletions tests/models/qwen2/test_modeling_qwen2.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ def test_model_450m_generation(self):
@require_bitsandbytes
@slow
@require_flash_attn
@pytest.mark.flash_attn_test
def test_model_450m_long_prompt(self):
EXPECTED_OUTPUT_TOKEN_IDS = [306, 338]
# An input with 4097 tokens that is above the size of the sliding window
Expand Down
1 change: 1 addition & 0 deletions tests/models/qwen2_moe/test_modeling_qwen2_moe.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ def test_model_a2_7b_generation(self):
@require_bitsandbytes
@slow
@require_flash_attn
@pytest.mark.flash_attn_test
def test_model_a2_7b_long_prompt(self):
EXPECTED_OUTPUT_TOKEN_IDS = [306, 338]
# An input with 4097 tokens that is above the size of the sliding window
Expand Down
2 changes: 2 additions & 0 deletions tests/models/stablelm/test_modeling_stablelm.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import unittest

import pytest
from parameterized import parameterized

from transformers import StableLmConfig, is_torch_available, set_seed
Expand Down Expand Up @@ -539,6 +540,7 @@ def test_model_tiny_random_stablelm_2_generation(self):
@require_bitsandbytes
@slow
@require_flash_attn
@pytest.mark.flash_attn_test
def test_model_3b_long_prompt(self):
EXPECTED_OUTPUT_TOKEN_IDS = [3, 3, 3]
input_ids = [306, 338] * 2047
Expand Down
1 change: 1 addition & 0 deletions tests/models/starcoder2/test_modeling_starcoder2.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ def test_starcoder2_batched_generation_eager(self):
self.assertEqual(EXPECTED_TEXT, output_text)

@require_flash_attn
@pytest.mark.flash_attn_test
def test_starcoder2_batched_generation_fa2(self):
EXPECTED_TEXT = [
"Hello my name is Younes and I am a student at the University of Liverpool. I am currently studying for my MSc in Computer Science. I am interested in the field of Machine Learning and I am currently working on",
Expand Down

0 comments on commit e85d863

Please sign in to comment.