[ModelRunner v2] Enable decoder token-wise pooling (#50931)

Signed-off-by: Taneem Ibrahim <taneem.ibrahim@gmail.com>
This commit is contained in:
Taneem Ibrahim
2026-08-06 22:21:52 +00:00
committed by GitHub
parent 4d341ca829
commit 9464529612
8 changed files with 86 additions and 58 deletions
@@ -231,7 +231,7 @@ def test_pooling_runner_supports_encoder_token_embedding() -> None:
assert runner.supported_tasks == {"token_embed"}
def test_pooling_runner_rejects_decoder_token_classification() -> None:
def test_pooling_runner_supports_decoder_token_classification() -> None:
model = MagicMock()
model.pooler.get_supported_tasks.return_value = {"token_classify"}
vllm_config = MagicMock()
@@ -239,13 +239,12 @@ def test_pooling_runner_rejects_decoder_token_classification() -> None:
vllm_config.model_config.attn_type = "decoder"
vllm_config.model_config.get_pooling_task.return_value = "token_classify"
with pytest.raises(ValueError, match="selects 'token_classify'") as exc_info:
PoolingRunner(model, vllm_config)
runner = PoolingRunner(model, vllm_config)
assert "Set an explicitly supported task" not in str(exc_info.value)
assert runner.supported_tasks == {"token_classify"}
def test_pooling_runner_filters_decoder_token_classification() -> None:
def test_pooling_runner_keeps_decoder_token_classification() -> None:
model = MagicMock()
model.pooler.get_supported_tasks.return_value = {"embed", "token_classify"}
vllm_config = MagicMock()
@@ -255,10 +254,10 @@ def test_pooling_runner_filters_decoder_token_classification() -> None:
runner = PoolingRunner(model, vllm_config)
assert runner.supported_tasks == {"embed"}
assert runner.supported_tasks == {"embed", "token_classify"}
def test_pooling_runner_filters_decoder_token_embedding() -> None:
def test_pooling_runner_keeps_decoder_token_embedding() -> None:
model = MagicMock()
model.pooler.get_supported_tasks.return_value = {"embed", "token_embed"}
vllm_config = MagicMock()
@@ -268,12 +267,10 @@ def test_pooling_runner_filters_decoder_token_embedding() -> None:
runner = PoolingRunner(model, vllm_config)
assert runner.supported_tasks == {"embed"}
assert runner.supported_tasks == {"embed", "token_embed"}
def test_pooling_runner_gates_embed_token_classification_to_encoder() -> None:
# BGE-M3's combined task emits per-token weights alongside the embedding,
# so it is enabled only where prefill is unchunked.
def test_pooling_runner_supports_embed_token_classification() -> None:
model = MagicMock()
model.pooler.get_supported_tasks.return_value = {"embed", "embed&token_classify"}
vllm_config = MagicMock()
@@ -285,7 +282,3 @@ def test_pooling_runner_gates_embed_token_classification_to_encoder() -> None:
"embed",
"embed&token_classify",
}
vllm_config.model_config.attn_type = "decoder"
vllm_config.model_config.get_pooling_task.return_value = "embed"
assert PoolingRunner(model, vllm_config).supported_tasks == {"embed"}