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
284dd80d
Unverified
Commit
284dd80d
authored
Mar 01, 2024
by
Hailey Schoelkopf
Committed by
GitHub
Mar 01, 2024
Browse files
always include EOS token in stopsequences if possible (#1480)
parent
d272c19f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
3 deletions
+15
-3
lm_eval/models/huggingface.py
lm_eval/models/huggingface.py
+5
-1
lm_eval/models/neuron_optimum.py
lm_eval/models/neuron_optimum.py
+5
-1
lm_eval/models/vllm_causallms.py
lm_eval/models/vllm_causallms.py
+5
-1
No files found.
lm_eval/models/huggingface.py
View file @
284dd80d
...
...
@@ -1151,8 +1151,12 @@ class HFLM(TemplateLM):
raise
ValueError
(
f
"Expected `kwargs` to be of type `dict` but got
{
type
(
gen_kwargs
)
}
"
)
# add EOS token to stop sequences
eos
=
self
.
tok_decode
(
self
.
eot_token_id
)
if
not
until
:
until
=
[
self
.
tok_decode
(
self
.
eot_token_id
)]
until
=
[
eos
]
else
:
until
.
append
(
eos
)
if
"max_gen_toks"
in
kwargs
.
keys
():
max_gen_toks
=
kwargs
.
pop
(
"max_gen_toks"
)
else
:
...
...
lm_eval/models/neuron_optimum.py
View file @
284dd80d
...
...
@@ -666,8 +666,12 @@ class NEURON_HF(TemplateLM):
raise
ValueError
(
f
"Expected `kwargs` to be of type `dict` but got
{
kwargs
}
"
)
# add EOS token to stop sequences
eos
=
self
.
tok_decode
(
self
.
eot_token_id
)
if
not
until
:
until
=
[
self
.
tok_decode
(
self
.
eot_token_id
)]
until
=
[
eos
]
else
:
until
.
append
(
eos
)
if
"max_gen_toks"
in
kwargs
.
keys
():
max_gen_toks
=
kwargs
.
pop
(
"max_gen_toks"
)
else
:
...
...
lm_eval/models/vllm_causallms.py
View file @
284dd80d
...
...
@@ -282,8 +282,12 @@ class VLLM(TemplateLM):
raise
ValueError
(
f
"Expected `kwargs` to be of type `dict` but got
{
gen_kwargs
}
"
)
# add EOS token to stop sequences
eos
=
self
.
tok_decode
(
self
.
eot_token_id
)
if
not
until
:
until
=
[
self
.
tokenizer
.
decode
(
self
.
eot_token_id
)]
until
=
[
eos
]
else
:
until
.
append
(
eos
)
if
"max_gen_toks"
in
kwargs
.
keys
():
max_gen_toks
=
kwargs
.
pop
(
"max_gen_toks"
)
else
:
...
...
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