Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tests/models/multimodal/generation/test_mllama.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pytest
import torch
from transformers import AutoConfig, AutoModelForImageTextToText, AutoTokenizer
from transformers import __version__ as TRANSFORMERS_VERSION

from vllm import LLM, SamplingParams
from vllm.attention.backends.flash_attn import FlashAttentionMetadata
Expand Down Expand Up @@ -285,6 +286,10 @@ def clear_cache():
@pytest.mark.parametrize("max_tokens", [128])
@pytest.mark.parametrize("num_logprobs", [5])
@pytest.mark.parametrize("attn_backend", LIST_ENC_DEC_SUPPORTED_BACKENDS)
@pytest.mark.skipif(
TRANSFORMERS_VERSION == "4.55.0",
reason="Transformers v4.55.0 has a regression issue on mllama, "
"see: https://github.com/huggingface/transformers/pull/40083")
Comment on lines +289 to +292
Copy link
Contributor

Choose a reason for hiding this comment

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

high

To improve maintainability and reduce code duplication, it's better to define this skipif condition as a constant and reuse it for all affected tests. This will make it easier to remove the skip condition in the future when the upstream issue is resolved.

Please define the following constant at the top of the file, for example after the imports:

MMLAMA_REGRESSION_TRANSFORMERS_4_55_0 = pytest.mark.skipif(
    TRANSFORMERS_VERSION == "4.55.0",
    reason="Transformers v4.55.0 has a regression issue on mllama, "
    "see: https://github.com/huggingface/transformers/pull/40083")

Then, you can apply it to this test and the others (test_models_multi_leading_images, test_models_interleaved_images, test_models_distributed) like this:

@MMLAMA_REGRESSION_TRANSFORMERS_4_55_0

def test_models_single_leading_image(hf_runner, vllm_runner, image_assets,
model, sizes, dtype, max_tokens,
num_logprobs,
Expand Down Expand Up @@ -313,6 +318,10 @@ def test_models_single_leading_image(hf_runner, vllm_runner, image_assets,
@pytest.mark.parametrize("max_tokens", [128])
@pytest.mark.parametrize("num_logprobs", [5])
@pytest.mark.parametrize("attn_backend", LIST_ENC_DEC_SUPPORTED_BACKENDS)
@pytest.mark.skipif(
TRANSFORMERS_VERSION == "4.55.0",
reason="Transformers v4.55.0 has a regression issue on mllama, "
"see: https://github.com/huggingface/transformers/pull/40083")
def test_models_multi_leading_images(hf_runner, vllm_runner, image_assets,
model, dtype, max_tokens, num_logprobs,
attn_backend: _Backend) -> None:
Expand Down Expand Up @@ -362,6 +371,10 @@ def test_models_multi_leading_images(hf_runner, vllm_runner, image_assets,
@pytest.mark.parametrize("max_tokens", [128])
@pytest.mark.parametrize("num_logprobs", [5])
@pytest.mark.parametrize("attn_backend", LIST_ENC_DEC_SUPPORTED_BACKENDS)
@pytest.mark.skipif(
TRANSFORMERS_VERSION == "4.55.0",
reason="Transformers v4.55.0 has a regression issue on mllama, "
"see: https://github.com/huggingface/transformers/pull/40083")
def test_models_interleaved_images(hf_runner, vllm_runner, image_assets, model,
dtype, max_tokens, num_logprobs,
attn_backend: _Backend) -> None:
Expand Down Expand Up @@ -402,6 +415,10 @@ def test_models_interleaved_images(hf_runner, vllm_runner, image_assets, model,
@pytest.mark.parametrize("dtype", ["bfloat16"])
@pytest.mark.parametrize("max_tokens", [64])
@pytest.mark.parametrize("num_logprobs", [5])
@pytest.mark.skipif(
TRANSFORMERS_VERSION == "4.55.0",
reason="Transformers v4.55.0 has a regression issue on mllama, "
"see: https://github.com/huggingface/transformers/pull/40083")
def test_models_distributed(
hf_runner,
vllm_runner,
Expand Down