Skip to content

Commit bee02f7

Browse files
authored
raise exception when generation size is more than model length (#571)
* raise exception when generation size is more than model length * trufflehog * trufflehog
1 parent fd479ee commit bee02f7

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

.github/workflows/trufflehog.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ jobs:
1616
fetch-depth: 0
1717
- name: Secret Scanning
1818
uses: trufflesecurity/trufflehog@main
19+
with:
20+
extra_args: --only-verified

src/lighteval/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535

3636
app = typer.Typer()
37+
app = typer.Typer(pretty_exceptions_show_locals=False)
3738

3839
logging_config = dict( # noqa C408
3940
version=1,

src/lighteval/models/vllm/vllm_model.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,11 @@ def greedy_until(
269269
f"{context_size + max_new_tokens=} which is greather than {self.max_length=}. Truncating context to {self.max_length - max_new_tokens} tokens."
270270
)
271271
context_size = self.max_length - max_new_tokens
272+
if context_size < 0:
273+
logger.critical(
274+
f"{context_size=} is less than 0, either reduce the max_new_tokens or increase model max length."
275+
)
276+
raise ValueError("Context size is less than 0.")
272277
inputs = [input[-context_size:] for input in inputs]
273278
else:
274279
if context_size > self.max_length:

0 commit comments

Comments
 (0)