Skip to content

Commit 928e8bb

Browse files
authored
hotfix #2262 (#2264)
* max_length - 1 (generation always >= 1) * vllm: fix rolling prefix_token * nit: add comment * fixup! max_length should be handled for logliklihoods * Revert "fixup! max_length should be handled for logliklihoods" This reverts commit 432d1a3.
1 parent b31f92e commit 928e8bb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lm_eval/models/api_models.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ def __init__(
104104
self._truncate = truncate
105105
self._max_gen_toks = int(max_gen_toks)
106106
self._seed = int(seed)
107-
eval_logger.info(f"Using max length {max_length}")
108-
self.max_length = max_length
107+
# max_length - 1 as we always have 1 token for generation
108+
eval_logger.info(f"Using max length {max_length} - 1")
109+
self.max_length = max_length - 1
109110
if int(num_concurrent) <= 1:
110111
eval_logger.info(
111112
"Concurrent requests are disabled. To enable concurrent requests, set `num_concurrent` > 1."
@@ -419,9 +420,9 @@ def batch_logliklehood_requests(
419420
for chunk in chunks:
420421
for cache_key, context_enc, continuation_enc in chunk:
421422
# max_length - 1 as we always have 1 token for generation
422-
inp = (context_enc + continuation_enc)[-(self.max_length - 1) :]
423+
inp = (context_enc + continuation_enc)[-(self.max_length) :]
423424
ctxlen = len(context_enc) - max(
424-
0, len(context_enc) + len(continuation_enc) - (self.max_length - 1)
425+
0, len(context_enc) + len(continuation_enc) - (self.max_length)
425426
)
426427

427428
inputs.append(inp)

0 commit comments

Comments
 (0)