[CI][RL] Consolidate RL entrypoint tests under tests/entrypoints/rl (#59948)

Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
Signed-off-by: aoshen02 <aoshen@inferact.ai>
Co-authored-by: wang.yuqi <yuqi.wang@daocloud.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
aoshen02
2026-10-07 08:29:09 +00:00
committed by GitHub
co-authored by wang.yuqi Claude Opus 5.5
parent bc8dd4ad27
commit 42ecc8eebe
20 changed files with 46 additions and 22 deletions
@@ -1,73 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import io
import numpy as np
import pybase64 as base64
import pytest
from ...utils import RemoteOpenAIServer
MODEL_NAME = "TitanML/tiny-mixtral"
# tiny-mixtral config: 8 local experts, top-2 routing, 2 hidden layers.
# Its published sliding window is incompatible with AuxOutput retention.
NUM_LOCAL_EXPERTS = 8
NUM_EXPERTS_PER_TOK = 2
NUM_HIDDEN_LAYERS = 2
def decode_routed_experts(encoded: str | None) -> np.ndarray:
assert encoded is not None
routed_experts = np.load(io.BytesIO(base64.b64decode(encoded)))
assert routed_experts.ndim == 3
num_tokens, num_layers, topk = routed_experts.shape
assert num_tokens > 0
assert num_layers == NUM_HIDDEN_LAYERS
assert topk == NUM_EXPERTS_PER_TOK
assert (routed_experts >= 0).all()
assert (routed_experts < NUM_LOCAL_EXPERTS).all()
return routed_experts
@pytest.fixture(scope="module")
def server():
args = [
"--max-model-len",
"256",
"--max-num-seqs",
"32",
"--enforce-eager",
"--enable-return-routed-experts",
"--hf-overrides",
'{"sliding_window": null}',
]
with RemoteOpenAIServer(
MODEL_NAME,
args,
env_dict={"VLLM_USE_V2_MODEL_RUNNER": "1"},
) as remote_server:
yield remote_server
@pytest.mark.asyncio
async def test_routed_experts(server):
"""Test that /v1/completions returns routed_experts when enabled."""
async with server.get_async_client() as client:
result = await client.completions.create(
model=MODEL_NAME,
prompt="Hello, world",
max_tokens=10,
temperature=0,
extra_body={"return_token_ids": True},
)
choice = result.model_dump()["choices"][0]
assert choice["token_ids"] is not None
assert result.usage is not None
routed_experts = decode_routed_experts(choice["routed_experts"])
assert len(routed_experts) == (
result.usage.prompt_tokens + len(choice["token_ids"]) - 1
)