Skip to content

Commit

Permalink
Remove caching
Browse files Browse the repository at this point in the history
  • Loading branch information
rlouf committed Aug 15, 2024
1 parent 25dc9be commit 9900429
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 387 deletions.
3 changes: 0 additions & 3 deletions benchmarks/bench_json_schema.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from outlines_core.caching import cache_disabled
from outlines_core.fsm.guide import RegexGuide
from outlines_core.fsm.json_schema import build_regex_from_schema

Expand Down Expand Up @@ -71,11 +70,9 @@ def setup(self, schema_name):
self.schema = schemas[schema_name]
ensure_numba_compiled(self.tokenizer)

@cache_disabled()
def time_json_schema_to_regex(self, schema_name):
build_regex_from_schema(self.schema)

@cache_disabled()
def time_json_schema_to_fsm(self, schema_name):
regex = build_regex_from_schema(self.schema)
RegexGuide(regex, self.tokenizer)
2 changes: 0 additions & 2 deletions benchmarks/bench_numba_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import interegular
import numba

from outlines_core.caching import cache_disabled
from outlines_core.fsm import regex

from .common import setup_tokenizer
Expand All @@ -29,6 +28,5 @@ def mock_njit(*args, **kwargs):
def teardown(self):
numba.njit = self.original_njit

@cache_disabled()
def time_compile_numba(self):
self.regex.create_fsm_index_tokenizer(self.regex_pattern, self.tokenizer)
3 changes: 0 additions & 3 deletions benchmarks/bench_regex_guide.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from outlines_core.caching import cache_disabled
from outlines_core.fsm.guide import RegexGuide

from .common import ensure_numba_compiled, setup_tokenizer
Expand All @@ -24,7 +23,6 @@ def setup(self, pattern_name):
ensure_numba_compiled(self.tokenizer)
self.pattern = regex_samples[pattern_name]

@cache_disabled()
def time_regex_to_guide(self, pattern_name):
RegexGuide(self.pattern, self.tokenizer)

Expand All @@ -37,6 +35,5 @@ def setup(self, pattern_name):
ensure_numba_compiled(self.tokenizer)
self.pattern = regex_samples[pattern_name]

@cache_disabled()
def peakmem_regex_to_guide(self, pattern_name):
RegexGuide(self.pattern, self.tokenizer)
7 changes: 1 addition & 6 deletions src/outlines_core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
"""Outlines is a Generative Model Programming Framework."""
import outlines_core.models
from outlines_core.caching import clear_cache, disable_cache, get_cache

__all__ = [
"clear_cache",
"disable_cache",
"get_cache",
]
__all__ = ["models"]
181 changes: 0 additions & 181 deletions src/outlines_core/caching.py

This file was deleted.

2 changes: 0 additions & 2 deletions src/outlines_core/fsm/guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import interegular
import torch

from outlines_core.caching import cache
from outlines_core.fsm.regex import (
create_fsm_index_tokenizer,
make_byte_level_fsm,
Expand Down Expand Up @@ -114,7 +113,6 @@ def copy(self):
return self


@cache()
def create_states_mapping(
regex_string: str,
tokenizer: "Tokenizer",
Expand Down
Loading

0 comments on commit 9900429

Please sign in to comment.