Skip to content

Commit

Permalink
Moved cache location and increased size.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelNiklaus committed Dec 31, 2024
1 parent cb16cc5 commit b79d686
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lighteval/models/transformers/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,10 @@ def __init__(

self.pairwise_tokenization = config.pairwise_tokenization

self._generation_cache = Cache(directory=os.path.join(env_config.cache_dir, "generation_cache"))
self._generation_cache = Cache(
directory=os.path.join(env_config.cache_dir, ".generation_cache"),
size_limit=10 * 1024**3, # 10GB
)

@classmethod
def from_model(
Expand Down Expand Up @@ -860,6 +863,7 @@ def _generate_cached(
do_sample: Optional[bool] = False,
) -> list[GenerativeResponse]:
# Create a cache key from the inputs
# TODO: add model name to the cache key
cache_key = (
hashlib.sha256(str(batch.input_ids.tolist()).encode()).hexdigest(),
max_new_tokens,
Expand Down

0 comments on commit b79d686

Please sign in to comment.