|
36 | 36 | from lighteval.models.model_output import ModelResponse |
37 | 37 | from lighteval.models.utils import _simplify_name, uses_chat_template |
38 | 38 | from lighteval.tasks.prompt_manager import PromptManager |
39 | | -from lighteval.tasks.requests import Doc |
| 39 | +from lighteval.tasks.requests import Doc, SamplingMethod |
40 | 40 | from lighteval.utils.cache_management import SampleCache, cached |
41 | 41 | from lighteval.utils.imports import is_vllm_available |
42 | 42 |
|
@@ -259,6 +259,7 @@ def _create_auto_model(self, config: VLLMModelConfig) -> Optional[LLM]: |
259 | 259 | "seed": int(config.seed), |
260 | 260 | "max_num_seqs": int(config.max_num_seqs), |
261 | 261 | "max_num_batched_tokens": int(config.max_num_batched_tokens), |
| 262 | + "enforce_eager": True, |
262 | 263 | } |
263 | 264 |
|
264 | 265 | if config.quantization is not None: |
@@ -300,7 +301,7 @@ def _create_auto_tokenizer(self, config: VLLMModelConfig): |
300 | 301 | tokenizer.pad_token = tokenizer.eos_token |
301 | 302 | return tokenizer |
302 | 303 |
|
303 | | - @cached("predictions") |
| 304 | + @cached("predictions", SamplingMethod.GENERATIVE) |
304 | 305 | def greedy_until( |
305 | 306 | self, |
306 | 307 | docs: list[Doc], |
@@ -459,7 +460,7 @@ def run_inference_one_model(model_args: dict, sampling_params: SamplingParams, r |
459 | 460 |
|
460 | 461 | return outputs |
461 | 462 |
|
462 | | - @cached("predictions") |
| 463 | + @cached("predictions", SamplingMethod.LOGPROBS) |
463 | 464 | def loglikelihood(self, docs: list[Doc]) -> list[ModelResponse]: |
464 | 465 | return self._loglikelihood_tokens(docs) |
465 | 466 |
|
@@ -528,7 +529,7 @@ def _loglikelihood_tokens( |
528 | 529 |
|
529 | 530 | return dataset.get_original_order(res) |
530 | 531 |
|
531 | | - @cached("predictions") |
| 532 | + @cached("predictions", SamplingMethod.LOGPROBS) |
532 | 533 | def loglikelihood_rolling(self, docs: list[Doc]) -> list[ModelResponse]: |
533 | 534 | raise NotImplementedError() |
534 | 535 |
|
@@ -624,7 +625,7 @@ async def _async_batch(self, docs: list[Doc], generative: bool) -> list: |
624 | 625 | results = await asyncio.gather(*processed_requests) |
625 | 626 | return results |
626 | 627 |
|
627 | | - @cached("predictions") |
| 628 | + @cached("predictions", SamplingMethod.GENERATIVE) |
628 | 629 | async def greedy_until( |
629 | 630 | self, |
630 | 631 | docs: list[Doc], |
@@ -659,7 +660,7 @@ async def greedy_until( |
659 | 660 |
|
660 | 661 | return results |
661 | 662 |
|
662 | | - @cached("predictions") |
| 663 | + @cached("predictions", SamplingMethod.LOGPROBS) |
663 | 664 | async def loglikelihood( |
664 | 665 | self, |
665 | 666 | docs: list[Doc], |
|
0 commit comments