A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 15, 19:45 UTC
[V1] Fix model parameterization for structured output tests (#14833)
Signed-off-by: Russell Bryant <rbryant@redhat.com>
Russell Bryant committed
Mar 14, 2025 at 16:55 UTC
46f98893dd0c30365116563ab660c360b29c276b
1 file changed
+11
-7
tests/v1/entrypoints/llm/test_struct_output_generate.py
+11
-7
@@ -14,18 +14,15 @@ from vllm.outputs import RequestOutput
14
from vllm.sampling_params import GuidedDecodingParams, SamplingParams
15
16
GUIDED_DECODING_BACKENDS_V1 = ["xgrammar"]
17
-
18
-
19
-@pytest.fixture
20
-def model_name():
21
- return [
22
- "Qwen/Qwen2.5-1.5B-Instruct", "mistralai/Ministral-8B-Instruct-2410"
23
- ]
17
+MODELS_TO_TEST = [
18
+ "Qwen/Qwen2.5-1.5B-Instruct", "mistralai/Ministral-8B-Instruct-2410"
19
+]
20
21
22
@pytest.mark.skip_global_cleanup
23
@pytest.mark.parametrize("guided_decoding_backend",
24
GUIDED_DECODING_BACKENDS_V1)
25
+@pytest.mark.parametrize("model_name", MODELS_TO_TEST)
26
def test_guided_json_completion(
27
monkeypatch: pytest.MonkeyPatch,
28
sample_json_schema: dict[str, Any],
@@ -63,6 +60,7 @@ def test_guided_json_completion(
60
@pytest.mark.skip_global_cleanup
61
@pytest.mark.parametrize("guided_decoding_backend",
62
GUIDED_DECODING_BACKENDS_V1)
63
+@pytest.mark.parametrize("model_name", MODELS_TO_TEST)
64
def test_guided_json_object(
65
monkeypatch: pytest.MonkeyPatch,
66
guided_decoding_backend: str,
@@ -101,6 +99,7 @@ def test_guided_json_object(
99
@pytest.mark.skip_global_cleanup
100
@pytest.mark.parametrize("guided_decoding_backend",
101
GUIDED_DECODING_BACKENDS_V1)
102
+@pytest.mark.parametrize("model_name", MODELS_TO_TEST)
103
def test_guided_json_unsupported_schema(
104
monkeypatch: pytest.MonkeyPatch,
105
unsupported_json_schema: dict[str, Any],
@@ -128,6 +127,7 @@ def test_guided_json_unsupported_schema(
127
@pytest.mark.skip_global_cleanup
128
@pytest.mark.parametrize("guided_decoding_backend",
129
GUIDED_DECODING_BACKENDS_V1)
130
+@pytest.mark.parametrize("model_name", MODELS_TO_TEST)
131
def test_guided_grammar_ebnf(
132
monkeypatch: pytest.MonkeyPatch,
133
sample_sql_ebnf: str,
@@ -170,6 +170,7 @@ def test_guided_grammar_ebnf(
170
@pytest.mark.skip_global_cleanup
171
@pytest.mark.parametrize("guided_decoding_backend",
172
GUIDED_DECODING_BACKENDS_V1)
173
+@pytest.mark.parametrize("model_name", MODELS_TO_TEST)
174
def test_guided_grammar_lark(
175
monkeypatch: pytest.MonkeyPatch,
176
sample_sql_lark: str,
@@ -217,6 +218,7 @@ def test_guided_grammar_lark(
218
@pytest.mark.skip_global_cleanup
219
@pytest.mark.parametrize("guided_decoding_backend",
220
GUIDED_DECODING_BACKENDS_V1)
221
+@pytest.mark.parametrize("model_name", MODELS_TO_TEST)
222
def test_guided_grammar_ebnf_invalid(
223
monkeypatch: pytest.MonkeyPatch,
224
guided_decoding_backend: str,
@@ -244,6 +246,7 @@ def test_guided_grammar_ebnf_invalid(
246
@pytest.mark.skip_global_cleanup
247
@pytest.mark.parametrize("guided_decoding_backend",
248
GUIDED_DECODING_BACKENDS_V1)
249
+@pytest.mark.parametrize("model_name", MODELS_TO_TEST)
250
def test_guided_regex(
251
monkeypatch: pytest.MonkeyPatch,
252
sample_regex: str,
@@ -280,6 +283,7 @@ def test_guided_regex(
283
@pytest.mark.skip_global_cleanup
284
@pytest.mark.parametrize("guided_decoding_backend",
285
GUIDED_DECODING_BACKENDS_V1)
286
+@pytest.mark.parametrize("model_name", MODELS_TO_TEST)
287
def test_guided_choice_completion(
288
monkeypatch: pytest.MonkeyPatch,
289
sample_guided_choice: str,