|
14 | 14 | from vllm.sampling_params import GuidedDecodingParams, SamplingParams |
15 | 15 |
|
16 | 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 | +] |
24 | 20 |
|
25 | 21 |
|
26 | 22 | @pytest.mark.skip_global_cleanup |
27 | 23 | @pytest.mark.parametrize("guided_decoding_backend", |
28 | 24 | GUIDED_DECODING_BACKENDS_V1) |
| 25 | +@pytest.mark.parametrize("model_name", MODELS_TO_TEST) |
29 | 26 | def test_guided_json_completion( |
30 | 27 | monkeypatch: pytest.MonkeyPatch, |
31 | 28 | sample_json_schema: dict[str, Any], |
@@ -63,6 +60,7 @@ def test_guided_json_completion( |
63 | 60 | @pytest.mark.skip_global_cleanup |
64 | 61 | @pytest.mark.parametrize("guided_decoding_backend", |
65 | 62 | GUIDED_DECODING_BACKENDS_V1) |
| 63 | +@pytest.mark.parametrize("model_name", MODELS_TO_TEST) |
66 | 64 | def test_guided_json_object( |
67 | 65 | monkeypatch: pytest.MonkeyPatch, |
68 | 66 | guided_decoding_backend: str, |
@@ -101,6 +99,7 @@ def test_guided_json_object( |
101 | 99 | @pytest.mark.skip_global_cleanup |
102 | 100 | @pytest.mark.parametrize("guided_decoding_backend", |
103 | 101 | GUIDED_DECODING_BACKENDS_V1) |
| 102 | +@pytest.mark.parametrize("model_name", MODELS_TO_TEST) |
104 | 103 | def test_guided_json_unsupported_schema( |
105 | 104 | monkeypatch: pytest.MonkeyPatch, |
106 | 105 | unsupported_json_schema: dict[str, Any], |
@@ -128,6 +127,7 @@ def test_guided_json_unsupported_schema( |
128 | 127 | @pytest.mark.skip_global_cleanup |
129 | 128 | @pytest.mark.parametrize("guided_decoding_backend", |
130 | 129 | GUIDED_DECODING_BACKENDS_V1) |
| 130 | +@pytest.mark.parametrize("model_name", MODELS_TO_TEST) |
131 | 131 | def test_guided_grammar_ebnf( |
132 | 132 | monkeypatch: pytest.MonkeyPatch, |
133 | 133 | sample_sql_ebnf: str, |
@@ -170,6 +170,7 @@ def test_guided_grammar_ebnf( |
170 | 170 | @pytest.mark.skip_global_cleanup |
171 | 171 | @pytest.mark.parametrize("guided_decoding_backend", |
172 | 172 | GUIDED_DECODING_BACKENDS_V1) |
| 173 | +@pytest.mark.parametrize("model_name", MODELS_TO_TEST) |
173 | 174 | def test_guided_grammar_lark( |
174 | 175 | monkeypatch: pytest.MonkeyPatch, |
175 | 176 | sample_sql_lark: str, |
@@ -217,6 +218,7 @@ def test_guided_grammar_lark( |
217 | 218 | @pytest.mark.skip_global_cleanup |
218 | 219 | @pytest.mark.parametrize("guided_decoding_backend", |
219 | 220 | GUIDED_DECODING_BACKENDS_V1) |
| 221 | +@pytest.mark.parametrize("model_name", MODELS_TO_TEST) |
220 | 222 | def test_guided_grammar_ebnf_invalid( |
221 | 223 | monkeypatch: pytest.MonkeyPatch, |
222 | 224 | guided_decoding_backend: str, |
@@ -244,6 +246,7 @@ def test_guided_grammar_ebnf_invalid( |
244 | 246 | @pytest.mark.skip_global_cleanup |
245 | 247 | @pytest.mark.parametrize("guided_decoding_backend", |
246 | 248 | GUIDED_DECODING_BACKENDS_V1) |
| 249 | +@pytest.mark.parametrize("model_name", MODELS_TO_TEST) |
247 | 250 | def test_guided_regex( |
248 | 251 | monkeypatch: pytest.MonkeyPatch, |
249 | 252 | sample_regex: str, |
@@ -280,6 +283,7 @@ def test_guided_regex( |
280 | 283 | @pytest.mark.skip_global_cleanup |
281 | 284 | @pytest.mark.parametrize("guided_decoding_backend", |
282 | 285 | GUIDED_DECODING_BACKENDS_V1) |
| 286 | +@pytest.mark.parametrize("model_name", MODELS_TO_TEST) |
283 | 287 | def test_guided_choice_completion( |
284 | 288 | monkeypatch: pytest.MonkeyPatch, |
285 | 289 | sample_guided_choice: str, |
|
0 commit comments