2025-06-16 16:36:43 +08:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
|
|
|
|
import pytest
|
|
|
|
|
|
2025-09-11 21:37:51 +08:00
|
|
|
from tests.models.utils import (
|
|
|
|
|
RerankModelInfo,
|
|
|
|
|
)
|
|
|
|
|
|
2025-12-24 23:36:20 +08:00
|
|
|
from .mteb_score_utils import mteb_test_rerank_models
|
2025-06-16 16:36:43 +08:00
|
|
|
|
|
|
|
|
RERANK_MODELS = [
|
2025-12-24 23:36:20 +08:00
|
|
|
RerankModelInfo(
|
2025-08-12 00:41:37 +08:00
|
|
|
"cross-encoder/ms-marco-TinyBERT-L-2-v2",
|
|
|
|
|
architecture="BertForSequenceClassification",
|
2026-01-10 12:53:24 +08:00
|
|
|
seq_pooling_type="CLS",
|
2025-12-24 23:36:20 +08:00
|
|
|
attn_type="encoder_only",
|
|
|
|
|
is_prefix_caching_supported=False,
|
|
|
|
|
is_chunked_prefill_supported=False,
|
2026-01-05 19:54:26 +08:00
|
|
|
mteb_score=0.32898,
|
2025-08-12 00:41:37 +08:00
|
|
|
),
|
2025-12-24 23:36:20 +08:00
|
|
|
RerankModelInfo(
|
2025-08-12 00:41:37 +08:00
|
|
|
"tomaarsen/Qwen3-Reranker-0.6B-seq-cls",
|
|
|
|
|
architecture="Qwen3ForSequenceClassification",
|
2026-01-10 12:53:24 +08:00
|
|
|
seq_pooling_type="LAST",
|
2025-12-24 23:36:20 +08:00
|
|
|
attn_type="decoder",
|
|
|
|
|
is_prefix_caching_supported=True,
|
|
|
|
|
is_chunked_prefill_supported=True,
|
2026-01-05 19:54:26 +08:00
|
|
|
chat_template_name="qwen3_reranker.jinja",
|
|
|
|
|
mteb_score=0.33459,
|
2025-10-05 15:06:22 +01:00
|
|
|
),
|
2025-06-16 16:36:43 +08:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("model_info", RERANK_MODELS)
|
2026-01-05 19:54:26 +08:00
|
|
|
def test_rerank_models_mteb(vllm_runner, model_info: RerankModelInfo) -> None:
|
|
|
|
|
mteb_test_rerank_models(vllm_runner, model_info)
|