Skip to content

Commit

Permalink
Reset FSM states in Regex after completion
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonwillard committed Sep 11, 2023
1 parent 3bf5bd0 commit e83cd73
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions outlines/text/generate/regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ def create_proposal(

return logits + mask

def postprocess_completions(self, completions: List[str]) -> List[str]:
self.pstates.clear()
return super().postprocess_completions(completions)


def regex(model, regex_string: str, max_tokens: Optional[int] = None):
"""Generate text sequences that match the input regex.
Expand Down

0 comments on commit e83cd73

Please sign in to comment.