Skip to content

Commit 88ca01e

Browse files
authored
Upstream compatibility tests (#343)
Since we test against "main" and "default" vLLM versions in our tests, we often add code to make "main" work ahead of our official support. But it's easy to forget this compatibility code and it can become technical debt later. In this PR I'm adding a new test file to that verifies "main" and "default" imports from vLLM so that the "default" tests starts failing one a compatibility code is not longer needed. --------- Signed-off-by: Max de Bayser <[email protected]>
1 parent a20dbd1 commit 88ca01e

File tree

9 files changed

+115
-5
lines changed

9 files changed

+115
-5
lines changed

.github/workflows/test.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ jobs:
5050
- name: "worker and utils"
5151
markers: "not e2e"
5252
flags: "--timeout=300"
53+
- name: "compatibility"
54+
markers: "compat"
55+
flags: "--timeout=300"
56+
include:
57+
- vllm_version:
58+
name: "vLLM:lowest"
59+
repo: "git+https://github.com/vllm-project/vllm --tag v0.9.2"
60+
test_suite:
61+
name: "backward compat"
62+
markers: "compat or (cpu and basic)"
63+
flags: "--timeout=300"
64+
os: "ubuntu-latest"
65+
python_version: "3.12"
5366

5467
name: "${{ matrix.test_suite.name }} (${{ matrix.vllm_version.name }})"
5568

@@ -90,6 +103,7 @@ jobs:
90103
if: (steps.changed-src-files.outputs.any_changed == 'true' && matrix.vllm_version.repo)
91104
run: |
92105
uv add ${{ matrix.vllm_version.repo }}
106+
echo "TEST_VLLM_VERSION=${{ matrix.vllm_version.name }}" >> "$GITHUB_ENV"
93107
94108
- name: "Install vLLM with Spyre plugin"
95109
if: steps.changed-src-files.outputs.any_changed == 'true'

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ asyncio_default_fixture_loop_scope = "function"
122122
markers = [
123123
"skip_global_cleanup",
124124
"e2e: Tests using end-to-end engine spin-up",
125+
"basic: Basic correctness tests",
125126
"cb: Continuous batching tests",
126127
"cpu: Tests using CPU (i.e. eager) backend",
128+
"compat: backward compatibility tests",
127129
"spyre: Tests using Spyre hardware backend",
128130
"decoder: Tests for decoder models",
129131
"embedding: Tests for embedding models",

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
def pytest_collection_modifyitems(config, items):
1919
""" Mark all tests in e2e directory"""
2020
for item in items:
21-
if "tests/e2e" in str(item.nodeid):
21+
if "e2e" in str(item.nodeid):
2222
item.add_marker(pytest.mark.e2e)
2323

2424

tests/e2e/test_spyre_embeddings.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@
1414

1515

1616
@pytest.mark.parametrize("model", get_spyre_model_list(isEmbeddings=True))
17-
@pytest.mark.parametrize("warmup_shape",
18-
[(64, 4), (64, 8), (128, 4),
19-
(128, 8)]) # (prompt_length/batch_size)
17+
@pytest.mark.parametrize(
18+
"warmup_shape",
19+
[ # (prompt_length/batch_size)
20+
pytest.param((64, 4), marks=pytest.mark.basic),
21+
pytest.param((64, 8)),
22+
pytest.param((128, 4)),
23+
pytest.param((128, 8))
24+
])
2025
@pytest.mark.parametrize("backend", get_spyre_backend_list())
2126
def test_output(
2227
model: str,

tests/e2e/test_spyre_online.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
@pytest.mark.parametrize("model", get_spyre_model_list())
77
@pytest.mark.parametrize("tp_size", [
8-
pytest.param(1),
8+
pytest.param(1, marks=pytest.mark.basic),
99
pytest.param(2, marks=pytest.mark.multi),
1010
pytest.param(4, marks=pytest.mark.multi),
1111
pytest.param(8, marks=pytest.mark.multi),
@@ -82,6 +82,7 @@ def test_openai_serving_gptq(remote_openai_server, model, backend,
8282
assert len(completion.choices[0].text) > 0
8383

8484

85+
@pytest.mark.basic
8586
@pytest.mark.parametrize("model", get_spyre_model_list())
8687
@pytest.mark.parametrize("cb",
8788
[pytest.param(1, marks=pytest.mark.cb, id="cb")])

tests/utils/test_spyre_backend_list.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44

55
@pytest.mark.utils
6+
@pytest.mark.cpu
67
def test_get_spyre_backend_list(monkeypatch):
78
'''
89
Ensure we return the backend list correctly

tests/utils/test_spyre_model_list.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44

55
@pytest.mark.utils
6+
@pytest.mark.cpu
67
def test_get_spyre_model_list(monkeypatch):
78
'''
89
Tests returning the expected models
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import os
2+
3+
import pytest
4+
from spyre_util import get_spyre_model_list
5+
6+
pytestmark = pytest.mark.compat
7+
8+
VLLM_VERSION = os.getenv("TEST_VLLM_VERSION", "default")
9+
10+
11+
@pytest.mark.cpu
12+
def test_vllm_bert_support():
13+
'''
14+
Test if the vllm version under test already has Bert support for V1
15+
'''
16+
17+
from vllm.model_executor.models.bert import BertEmbeddingModel
18+
19+
bert_supports_v0_only = getattr(BertEmbeddingModel, "supports_v0_only",
20+
False)
21+
22+
if VLLM_VERSION == "vLLM:main":
23+
assert not bert_supports_v0_only
24+
elif VLLM_VERSION == "vLLM:lowest":
25+
assert bert_supports_v0_only, (
26+
"The lowest supported vLLM version already"
27+
"supports Bert in V1. Remove the compatibility workarounds.")
28+
# The compat code introduced in the PR below can now be removed:
29+
# https://github.com/vllm-project/vllm-spyre/pull/277
30+
31+
32+
@pytest.mark.cpu
33+
@pytest.mark.parametrize("model", get_spyre_model_list())
34+
def test_model_config_task(model: str):
35+
36+
from vllm.engine.arg_utils import EngineArgs
37+
38+
vllm_config = EngineArgs(model=model).create_engine_config()
39+
model_config = vllm_config.model_config
40+
41+
task = getattr(model_config, "task", None)
42+
43+
if VLLM_VERSION == "vLLM:main":
44+
assert task is None
45+
elif VLLM_VERSION == "vLLM:lowest":
46+
assert task is not None, (
47+
"The lowest supported vLLM version already"
48+
"switched to the new definition of runners and task.")
49+
# The compat code introduced in the PR below can now be removed:
50+
# https://github.com/vllm-project/vllm-spyre/pull/341
51+
52+
53+
@pytest.mark.cpu
54+
def test_has_tasks():
55+
56+
try:
57+
from vllm import tasks # noqa
58+
has_tasks = True
59+
except Exception:
60+
has_tasks = False
61+
62+
if VLLM_VERSION == "vLLM:main":
63+
assert has_tasks
64+
elif VLLM_VERSION == "vLLM:lowest":
65+
assert not has_tasks, (
66+
"The lowest supported vLLM version already"
67+
"switched to the new definition of runners and task.")
68+
# The compat code introduced in the PR below can now be removed:
69+
# https://github.com/vllm-project/vllm-spyre/pull/338
70+
71+
72+
@pytest.mark.cpu
73+
def test_pooler_from_config():
74+
75+
from vllm.model_executor.layers.pooler import Pooler
76+
has_from_config = hasattr(Pooler, "from_config_with_defaults")
77+
78+
if VLLM_VERSION == "vLLM:main":
79+
assert not has_from_config
80+
elif VLLM_VERSION == "vLLM:lowest":
81+
assert has_from_config, (
82+
"The lowest supported vLLM version already"
83+
"switched to the new definition of runners and task.")
84+
# The compat code introduced in the PR below can now be removed:
85+
# https://github.com/vllm-project/vllm-spyre/pull/338

tests/v1/worker/test_spyre_input_batch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ def same(t1: Optional[torch.Tensor], t2: Optional[torch.Tensor]) -> bool:
211211
sampling_metadata.bad_words_token_ids
212212

213213

214+
@pytest.mark.cpu
214215
@pytest.mark.worker
215216
@pytest.mark.parametrize("batch_size", [1, 2, 32, 64])
216217
def test_sampling_metadata_in_input_batch(batch_size: int):

0 commit comments

Comments
 (0)