Skip to content
Closed
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
6 changes: 3 additions & 3 deletions src/lighteval/models/vllm/vllm_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def _greedy_until(
# The choice we go for here is to avoid truncating the prompt if we can, since it
# should have been managed by the prompt creator/few shot manager if requested by the user.
inputs = tokenized["input_ids"]
context_size = len(inputs[0])
context_size = max(len(inp) for inp in inputs)

# left truncate the inputs to the maximum length
if self.max_length is None:
Expand All @@ -365,7 +365,7 @@ def _greedy_until(
elif max_new_tokens is not None:
if context_size + max_new_tokens > self.max_length:
logger.warning(
f"{context_size + max_new_tokens=} which is greater than {self.max_length=}. Truncating context to {self.max_length - max_new_tokens} tokens."
f"Batch max length {context_size} + {max_new_tokens=} which is greater than {self.max_length=}. Truncating context to {self.max_length - max_new_tokens} tokens."
)
context_size = self.max_length - max_new_tokens
if context_size < 0:
Expand All @@ -377,7 +377,7 @@ def _greedy_until(
else:
if context_size > self.max_length:
logger.warning(
f"{context_size=} which is greater than {self.max_length=}. Truncating context to {self.max_length} tokens."
f"Batch max length {context_size=} which is greater than {self.max_length=}. Truncating context to {self.max_length} tokens."
)
context_size = self.max_length
inputs = [input[-context_size:] for input in inputs]
Expand Down