Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix PERPLEXITY task evaluation crash due to incorrect sampling method detection
Issue
Evaluating perplexity-based tasks (e.g., lighteval|wikitext:103:document_level|0) causes an IndexError crash:
File "lighteval/logging/info_loggers.py", line 298, in aggregate
hash_types: list[str] = list(self.compiled_details.values())[0].hashes.keys()
IndexError: list index out of range
Root Cause
The @cached decorator in cache_management.py incorrectly filters out all PERPLEXITY responses:
- get_sampling_method() cannot distinguish between PERPLEXITY and LOGPROBS responses
- Both have non-empty logprobs, so it returns SamplingMethod.LOGPROBS for PERPLEXITY tasks
- The key difference: PERPLEXITY responses have empty text=[], while LOGPROBS typically has text
- The decorator filters cached results by sampling method
- Looks for SamplingMethod.PERPLEXITY but finds SamplingMethod.LOGPROBS
- All 62 valid responses filtered out → returns empty list []
- DetailsLogger.aggregate() assumes at least one task has details
- Accesses list(self.compiled_details.values())[0] on empty dict
- Raises IndexError
Fixes