Unverified Commit 1f106ee3 authored by Xinyuan Tong's avatar Xinyuan Tong Committed by GitHub
Browse files

[grammar] Avoid server crash when grammar backend is None (#11401)

parent 9b8ebb27
...@@ -1442,7 +1442,10 @@ class Scheduler( ...@@ -1442,7 +1442,10 @@ class Scheduler(
or req.sampling_params.ebnf is not None or req.sampling_params.ebnf is not None
or req.sampling_params.structural_tag is not None or req.sampling_params.structural_tag is not None
): ):
assert self.grammar_backend is not None if self.grammar_backend is None:
error_msg = "Grammar-based generation (json_schema, regex, ebnf, structural_tag) is not supported when the server is launched with --grammar-backend none"
req.set_finish_with_abort(error_msg)
else:
if req.sampling_params.json_schema is not None: if req.sampling_params.json_schema is not None:
key = ("json", req.sampling_params.json_schema) key = ("json", req.sampling_params.json_schema)
elif req.sampling_params.regex is not None: elif req.sampling_params.regex is not None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment