Skip to content

Commit

Permalink
Apply lru_cache to RegexFSM
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Lapp committed Feb 7, 2024
1 parent 1626cea commit 4ec72a1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions outlines/fsm/fsm.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import functools
from typing import TYPE_CHECKING, List, NewType, Protocol, Tuple

import interegular
Expand Down Expand Up @@ -88,6 +89,7 @@ def copy(self) -> "StopAtEosFSM":
return self


@functools.lru_cache(maxsize=1024)
class RegexFSM(FSM):
"""FSM to generate text that is in the language of a regular expression."""

Expand Down

0 comments on commit 4ec72a1

Please sign in to comment.