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
deecaa1a
Unverified
Commit
deecaa1a
authored
Aug 03, 2023
by
Lintang Sutawika
Committed by
GitHub
Aug 03, 2023
Browse files
Merge pull request #723 from EleutherAI/fix_max_length
[Refactor] Fix Max Length arg
parents
d88a566c
53105bba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
lm_eval/api/task.py
lm_eval/api/task.py
+0
-1
lm_eval/models/huggingface.py
lm_eval/models/huggingface.py
+3
-1
No files found.
lm_eval/api/task.py
View file @
deecaa1a
...
@@ -990,7 +990,6 @@ class ConfigurableTask(Task):
...
@@ -990,7 +990,6 @@ class ConfigurableTask(Task):
choices
=
self
.
doc_to_choice
(
doc
)
choices
=
self
.
doc_to_choice
(
doc
)
gold
=
choices
[
gold
]
gold
=
choices
[
gold
]
print
(
self
.
_metric_fn_list
)
for
key
,
result
in
zip
(
self
.
_metric_fn_list
.
keys
(),
results
):
for
key
,
result
in
zip
(
self
.
_metric_fn_list
.
keys
(),
results
):
if
self
.
multiple_target
:
if
self
.
multiple_target
:
# in the case where we have multiple targets,
# in the case where we have multiple targets,
...
...
lm_eval/models/huggingface.py
View file @
deecaa1a
...
@@ -757,11 +757,13 @@ class HFLM(LM):
...
@@ -757,11 +757,13 @@ class HFLM(LM):
context_enc
=
context_enc
.
to
(
self
.
device
)
context_enc
=
context_enc
.
to
(
self
.
device
)
attn_masks
=
attn_masks
.
to
(
self
.
device
)
attn_masks
=
attn_masks
.
to
(
self
.
device
)
if
"max_length"
not
in
kwargs
:
kwargs
[
"max_length"
]
=
(
context_enc
.
shape
[
1
]
+
max_gen_toks
,)
# perform batched generation
# perform batched generation
cont
=
self
.
_model_generate
(
cont
=
self
.
_model_generate
(
context
=
context_enc
,
context
=
context_enc
,
attention_mask
=
attn_masks
,
attention_mask
=
attn_masks
,
max_length
=
context_enc
.
shape
[
1
]
+
max_gen_toks
,
stop
=
primary_until
,
stop
=
primary_until
,
**
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