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
aeebf6f2
Commit
aeebf6f2
authored
Jul 03, 2023
by
haileyschoelkopf
Browse files
fix and gather sample logging
parent
d15ee17a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
lm_eval/evaluator.py
lm_eval/evaluator.py
+10
-1
No files found.
lm_eval/evaluator.py
View file @
aeebf6f2
...
@@ -281,7 +281,7 @@ def evaluate(
...
@@ -281,7 +281,7 @@ def evaluate(
"doc_id"
:
doc_id
,
"doc_id"
:
doc_id
,
"doc"
:
doc
,
"doc"
:
doc
,
"target"
:
target
,
"target"
:
target
,
"arguments"
:
req
.
args
,
"arguments"
:
req
uests
[
0
]
.
args
,
"resps"
:
[
req
.
resps
for
req
in
requests
],
"resps"
:
[
req
.
resps
for
req
in
requests
],
"filtered_resps"
:
[
req
.
filtered_resps
[
key
]
for
req
in
requests
],
"filtered_resps"
:
[
req
.
filtered_resps
[
key
]
for
req
in
requests
],
}
}
...
@@ -292,6 +292,15 @@ def evaluate(
...
@@ -292,6 +292,15 @@ def evaluate(
if
lm
.
world_size
>
1
:
if
lm
.
world_size
>
1
:
# if multigpu, then gather data across all ranks
# if multigpu, then gather data across all ranks
# first gather logged samples across all ranks
for
task_name
,
task_samples
in
list
(
samples
.
items
()):
full_samples
=
[
None
]
*
lm
.
world_size
torch
.
distributed
.
all_gather_object
(
full_samples
,
task_samples
)
samples
[
task_name
]
=
list
(
itertools
.
chain
.
from_iterable
(
full_samples
))
# then collect metrics across all ranks
vals_torch
=
collections
.
defaultdict
(
list
)
vals_torch
=
collections
.
defaultdict
(
list
)
for
(
task_name
,
key
,
metric
),
items
in
vals
.
items
():
for
(
task_name
,
key
,
metric
),
items
in
vals
.
items
():
...
...
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