mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-09-12 04:44:52 +00:00
quick fix
This commit is contained in:
parent
4700465192
commit
33cb2cefed
@ -521,7 +521,11 @@ class GrammarLogitProcessor(LogitsProcessor):
|
|||||||
def _cached_compile_fsm(grammar_type, schema, tokenizer):
|
def _cached_compile_fsm(grammar_type, schema, tokenizer):
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
if grammar_type == GrammarType.GRAMMAR_TYPE_JSON:
|
if grammar_type == GrammarType.GRAMMAR_TYPE_JSON:
|
||||||
schema = build_regex_from_schema(schema)
|
try:
|
||||||
|
schema = build_regex_from_schema(schema)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Error compiling FSM: {e}")
|
||||||
|
return None
|
||||||
elif grammar_type == GrammarType.GRAMMAR_TYPE_REGEX:
|
elif grammar_type == GrammarType.GRAMMAR_TYPE_REGEX:
|
||||||
pass # schema is already a regex just here for clarity
|
pass # schema is already a regex just here for clarity
|
||||||
fsm = RegexFSM(schema, tokenizer)
|
fsm = RegexFSM(schema, tokenizer)
|
||||||
|
Loading…
Reference in New Issue
Block a user