allow silent failure

This commit is contained in:
erikkaum 2024-07-25 14:39:15 +02:00
parent 33cb2cefed
commit 270ec41b09

View File

@ -524,8 +524,9 @@ class GrammarLogitProcessor(LogitsProcessor):
try:
schema = build_regex_from_schema(schema)
except Exception as e:
logger.error(f"Error compiling FSM: {e}")
return None
logger.error(f"Error compiling FSM, grammar won't be enforced \n{e}")
# allows everything
schema = "(.*?)"
elif grammar_type == GrammarType.GRAMMAR_TYPE_REGEX:
pass # schema is already a regex just here for clarity
fsm = RegexFSM(schema, tokenizer)