Skip to content

Commit 0902bbf

Browse files
committed
version compatibility
Signed-off-by: wangli <wangli858794774@gmail.com>
1 parent fa866a5 commit 0902bbf

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

tests/e2e/singlecard/test_guided_decoding.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,17 @@ def test_guided_json_completion(guided_decoding_backend: str,
108108
"max_tokens": 500,
109109
})
110110

111-
backwoards_compatibility_kwargs = {}
111+
runner_kwargs = {
112+
"seed": 0,
113+
}
112114
if vllm_version_is("0.10.2"):
113-
backwoards_compatibility_kwargs[
114-
"guided_decoding_backend"] = guided_decoding_backend
115+
runner_kwargs["guided_decoding_backend"] = guided_decoding_backend
115116
else:
116-
backwoards_compatibility_kwargs["structured_outputs_config"] = {
117+
runner_kwargs["structured_outputs_config"] = {
117118
"backend": guided_decoding_backend
118119
}
119120

120-
with VllmRunner(MODEL_NAME, seed=0,
121-
**backwoards_compatibility_kwargs) as vllm_model:
121+
with VllmRunner(MODEL_NAME, **runner_kwargs) as vllm_model:
122122
prompts = [
123123
f"Give an example JSON for an employee profile "
124124
f"that fits this schema: {sample_json_schema}"
@@ -147,22 +147,23 @@ def test_guided_regex(guided_decoding_backend: str, sample_regex):
147147
if guided_decoding_backend == "outlines":
148148
pytest.skip("Outlines doesn't support regex-based guided decoding.")
149149

150-
struct_output_params = StructuredOutputsParams(json=sample_json_schema, )
150+
struct_output_params = StructuredOutputsParams(json=sample_regex, )
151151
sampling_params = construct_sampling_params(struct_output_params, {
152152
"temperature": 0.8,
153153
"top_p": 0.95,
154154
})
155-
backwoards_compatibility_kwargs = {}
155+
156+
runner_kwargs = {
157+
"seed": 0,
158+
}
156159
if vllm_version_is("0.10.2"):
157-
backwoards_compatibility_kwargs[
158-
"guided_decoding_backend"] = guided_decoding_backend
160+
runner_kwargs["guided_decoding_backend"] = guided_decoding_backend
159161
else:
160-
backwoards_compatibility_kwargs["structured_outputs_config"] = {
162+
runner_kwargs["structured_outputs_config"] = {
161163
"backend": guided_decoding_backend
162164
}
163165

164-
with VllmRunner(MODEL_NAME, seed=0,
165-
**backwoards_compatibility_kwargs) as vllm_model:
166+
with VllmRunner(MODEL_NAME, **runner_kwargs) as vllm_model:
166167
prompts = [
167168
f"Give an example IPv4 address with this regex: {sample_regex}"
168169
] * 2

0 commit comments

Comments
 (0)