Misc clean up; Remove the support of jump forward (#4032)
This commit is contained in:
@@ -80,7 +80,6 @@ def create_grammar_backend(server_args: ServerArgs, tokenizer, vocab_size):
|
||||
grammar_backend = OutlinesGrammarBackend(
|
||||
tokenizer,
|
||||
whitespace_pattern=server_args.constrained_json_whitespace_pattern,
|
||||
allow_jump_forward=not server_args.disable_jump_forward,
|
||||
)
|
||||
elif server_args.grammar_backend == "xgrammar":
|
||||
from sglang.srt.constrained.xgrammar_backend import XGrammarGrammarBackend
|
||||
|
||||
@@ -115,7 +115,6 @@ class OutlinesGrammarBackend(BaseGrammarBackend):
|
||||
self,
|
||||
tokenizer,
|
||||
whitespace_pattern: bool,
|
||||
allow_jump_forward: bool,
|
||||
):
|
||||
super().__init__()
|
||||
|
||||
@@ -140,7 +139,6 @@ class OutlinesGrammarBackend(BaseGrammarBackend):
|
||||
self.outlines_tokenizer.vocabulary = (
|
||||
self.outlines_tokenizer.tokenizer.get_vocab()
|
||||
)
|
||||
self.allow_jump_forward = allow_jump_forward
|
||||
self.whitespace_pattern = whitespace_pattern
|
||||
|
||||
def init_value_impl(self, key: Tuple[str, str]) -> OutlinesGrammar:
|
||||
@@ -172,10 +170,7 @@ class OutlinesGrammarBackend(BaseGrammarBackend):
|
||||
logger.warning(f"skip invalid regex schema: {regex=}, {e=}")
|
||||
return None
|
||||
|
||||
if self.allow_jump_forward:
|
||||
jump_forward_map = OutlinesJumpForwardMap(regex)
|
||||
else:
|
||||
jump_forward_map = None
|
||||
jump_forward_map = None
|
||||
return OutlinesGrammar(guide, jump_forward_map)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user