Skip to content
Open
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
7 changes: 6 additions & 1 deletion src/lighteval/utils/cache_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ def get_task_id(self, task_name: str, sampling_method: SamplingMethod) -> TaskID

def get_sampling_method(self, sample: dict) -> str:
if len(sample.get("logprobs", [])) > 0:
if len(sample.get("text", [])) == 0:
return SamplingMethod.PERPLEXITY
return SamplingMethod.LOGPROBS
if len(sample.get("text", [])) > 0:
return SamplingMethod.GENERATIVE
Expand Down Expand Up @@ -269,7 +271,10 @@ def get_samples_to_process_and_cache(
return docs_not_cached, set(tasks_with_cached_samples)

def get_samples_from_cache(
self, docs: List[Doc], task_ids: List[TaskID] | set[TaskID], sampling_method: SamplingMethod
self,
docs: List[Doc],
task_ids: List[TaskID] | set[TaskID],
sampling_method: SamplingMethod,
) -> List[dict | ModelResponse]:
"""Get cached samples for the given docs.
Warning: Assumes all docs and task_names provided are stored in cache, will fail otherwise.
Expand Down