Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions syncode/grammar_mask/grammar_constrainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@ def _parse_partial_code(self, idx: int, partial_code: str, remainder_bytes: byte

self._update_valid_state(partial_code, idx, res)
except Exception as e:
if self.dev_mode == True:
if self.dev_mode == True and accepted_generation:
raise e
elif self.parse_failed == False and accepted_generation:
self.parse_failed = True
print("-"*50)
print(f"Parsing failed! Falling back to unconstrained decoding.\nException: {e}\nPartial code: {partial_code}\nParsed lexical tokens: {self.inc_parser.parsed_lexer_tokens}")
print("-"*50)
logger.info("-"*50)
logger.info(f"Parsing failed! Falling back to unconstrained decoding.\nException: {e}\nPartial code: {partial_code}\nParsed lexical tokens: {self.inc_parser.parsed_lexer_tokens}")
logger.info("-"*50)
skip = True
return res, skip

Expand Down