Skip to content

Commit

Permalink
hotfix #2262 (#2264)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
baberabb committed Aug 30, 2024
1 parent b31f92e commit 928e8bb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lm_eval/models/api_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ def __init__(
self._truncate = truncate
self._max_gen_toks = int(max_gen_toks)
self._seed = int(seed)
eval_logger.info(f"Using max length {max_length}")
self.max_length = max_length
# max_length - 1 as we always have 1 token for generation
eval_logger.info(f"Using max length {max_length} - 1")
self.max_length = max_length - 1
if int(num_concurrent) <= 1:
eval_logger.info(
"Concurrent requests are disabled. To enable concurrent requests, set `num_concurrent` > 1."
Expand Down Expand Up @@ -419,9 +420,9 @@ def batch_logliklehood_requests(
for chunk in chunks:
for cache_key, context_enc, continuation_enc in chunk:
# max_length - 1 as we always have 1 token for generation
inp = (context_enc + continuation_enc)[-(self.max_length - 1) :]
inp = (context_enc + continuation_enc)[-(self.max_length) :]
ctxlen = len(context_enc) - max(
0, len(context_enc) + len(continuation_enc) - (self.max_length - 1)
0, len(context_enc) + len(continuation_enc) - (self.max_length)
)

inputs.append(inp)
Expand Down

0 comments on commit 928e8bb

Please sign in to comment.