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
292e5814
Unverified
Commit
292e5814
authored
Mar 04, 2024
by
Hailey Schoelkopf
Committed by
GitHub
Mar 04, 2024
Browse files
Fix minor edge cases (#951 #1503) (#1520)
* Fix padding * Fix elif in model loading * format
parent
45823914
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
lm_eval/evaluator.py
lm_eval/evaluator.py
+9
-3
No files found.
lm_eval/evaluator.py
View file @
292e5814
...
@@ -152,7 +152,7 @@ def simple_evaluate(
...
@@ -152,7 +152,7 @@ def simple_evaluate(
if
model_args
is
None
:
if
model_args
is
None
:
model_args
=
""
model_args
=
""
el
if
isinstance
(
model_args
,
dict
):
if
isinstance
(
model_args
,
dict
):
lm
=
lm_eval
.
api
.
registry
.
get_model
(
model
).
create_from_arg_obj
(
lm
=
lm_eval
.
api
.
registry
.
get_model
(
model
).
create_from_arg_obj
(
model_args
,
model_args
,
{
{
...
@@ -348,10 +348,16 @@ def evaluate(
...
@@ -348,10 +348,16 @@ def evaluate(
gathered_item
=
(
gathered_item
=
(
lm
.
accelerator
.
gather
(
instances_rnk
).
cpu
().
detach
().
numpy
().
tolist
()
lm
.
accelerator
.
gather
(
instances_rnk
).
cpu
().
detach
().
numpy
().
tolist
()
)
)
# "multiple_choice" task types dispatch (several) "loglikelihood" request types
reqtype
=
(
"loglikelihood"
if
task
.
OUTPUT_TYPE
==
"multiple_choice"
else
task
.
OUTPUT_TYPE
)
# compute number of pseudo-batches to pad with (FSDP/DDP require even batches among ranks)
# compute number of pseudo-batches to pad with (FSDP/DDP require even batches among ranks)
numpad
=
max
(
gathered_item
)
-
gathered_item
[
lm
.
rank
]
numpad
=
max
(
gathered_item
)
-
gathered_item
[
lm
.
rank
]
padding_requests
[
task
.
OUTPUT_TYPE
]
+=
numpad
# todo: may not account for padding in cases like SquadV2 which has multiple req types
padding_requests
[
reqtype
]
+=
numpad
### Run LM on inputs, get all outputs ###
### Run LM on inputs, get all outputs ###
# execute each type of request
# execute each type of request
...
...
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