Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
lm-evaluation-harness
Commits
2bfc3ce4
Commit
2bfc3ce4
authored
Oct 16, 2025
by
Baber
Browse files
if max_length reached truncate generations
parent
6f66224b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
lm_eval/models/vllm_causallms.py
lm_eval/models/vllm_causallms.py
+7
-7
No files found.
lm_eval/models/vllm_causallms.py
View file @
2bfc3ce4
...
...
@@ -283,6 +283,10 @@ class VLLM(TemplateLM):
@
property
def
max_length
(
self
):
return
8096
if
self
.
_max_length
>
8096
else
self
.
_max_length
@
property
def
_max_length
(
self
):
if
self
.
_max_length
:
# if max length manually set, return it
return
self
.
_max_length
if
self
.
data_parallel_size
<=
1
:
...
...
@@ -627,13 +631,9 @@ class VLLM(TemplateLM):
# set the max length in tokens of inputs ("context_enc")
# max len for inputs = max length, minus room to generate the max new tokens
max_ctx_len
=
self
.
max_length
-
max_gen_toks
if
len
(
x
)
>
max_ctx_len
:
eval_logger
.
warning
(
f
"Context length
{
len
(
x
)
}
exceeds max length (context + max gen tokens):
{
max_ctx_len
}
. Truncating context."
)
context_encoding_truncated
.
append
(
x
[
-
max_ctx_len
:])
else
:
default_length
=
len
(
x
)
+
max_gen_toks
if
default_length
>
self
.
max_length
:
max_gen_toks
=
self
.
max_length
-
len
(
x
)
context_encoding_truncated
.
append
(
x
)
# create sampling params
kwargs
=
self
.
modify_gen_kwargs
(
kwargs
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment