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
d3cfdcf6
Unverified
Commit
d3cfdcf6
authored
Jun 22, 2023
by
Hailey Schoelkopf
Committed by
GitHub
Jun 22, 2023
Browse files
Merge pull request #5 from EleutherAI/seq2seq-support
fix edge cases for seq2seq
parents
89ad0186
0500fb33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
lm_eval/models/huggingface.py
lm_eval/models/huggingface.py
+4
-4
No files found.
lm_eval/models/huggingface.py
View file @
d3cfdcf6
...
...
@@ -127,7 +127,7 @@ class HFLM(LM):
)
self
.
model
.
to
(
self
.
device
)
else
:
self
.
model
=
accelerator
.
prepare
(
self
.
model
)
self
.
_
model
=
accelerator
.
prepare
(
self
.
model
)
self
.
_device
=
torch
.
device
(
f
"cuda:
{
accelerator
.
local_process_index
}
"
)
self
.
accelerator
=
accelerator
...
...
@@ -373,7 +373,7 @@ class HFLM(LM):
assert
len
(
continuation_enc
)
>
0
assert
len
(
continuation_enc
)
<=
self
.
max_length
# how this all works:
# how this all works
(illustrated on a causal decoder-only setup)
:
# CTX CONT
# inp 0 1 2 3|4 5 6 7 8 9 <- last token is deleted by inp[:, :-1]
# model \ \
...
...
@@ -519,7 +519,6 @@ class HFLM(LM):
max_gen_toks
=
gen_kwargs
.
pop
(
"max_gen_toks"
)
else
:
max_gen_toks
=
self
.
max_gen_toks
# first stop sequence is used to halt generation upon encountering
(
primary_until
)
=
until
[
0
]
...
...
@@ -552,7 +551,8 @@ class HFLM(LM):
# use secondary stop seqs to cut off should-have-been-stopped content post-hoc
for
term
in
until
:
s
=
s
.
split
(
term
)[
0
]
if
len
(
term
)
>
0
:
# ignore '' separator, for seq2seq case where
s
=
s
.
split
(
term
)[
0
]
res
.
append
(
s
)
...
...
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