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
OpenDAS
opencompass
Commits
ad96f215
"...pytorch/ogb/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "38b3d0c4ccfada8c5034932d0559d65f0d39bddc"
Unverified
Commit
ad96f215
authored
Dec 25, 2023
by
Songyang Zhang
Committed by
GitHub
Dec 25, 2023
Browse files
Update merge script (#733)
parent
336d8d76
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
tools/convert_alignmentbench.py
tools/convert_alignmentbench.py
+15
-4
No files found.
tools/convert_alignmentbench.py
View file @
ad96f215
...
@@ -16,10 +16,21 @@ def extract_predictions_from_json(input_folder):
...
@@ -16,10 +16,21 @@ def extract_predictions_from_json(input_folder):
for
model_name
in
os
.
listdir
(
pred_folder
):
for
model_name
in
os
.
listdir
(
pred_folder
):
model_folder
=
os
.
path
.
join
(
pred_folder
,
model_name
)
model_folder
=
os
.
path
.
join
(
pred_folder
,
model_name
)
json_paths
=
glob
(
os
.
path
.
join
(
model_folder
,
'alignment_bench_*.json'
))
try
:
# sorted by index
# when use split
json_paths
=
sorted
(
json_paths
=
glob
(
json_paths
,
key
=
lambda
x
:
int
(
x
.
split
(
'.json'
)[
0
].
split
(
'_'
)[
-
1
]))
os
.
path
.
join
(
model_folder
,
'alignment_bench_*.json'
))
# sorted by index
json_paths
=
sorted
(
json_paths
,
key
=
lambda
x
:
int
(
x
.
split
(
'.json'
)[
0
].
split
(
'_'
)[
-
1
]))
except
Exception
as
e
:
# when only one complete file
print
(
e
)
json_paths
=
[
os
.
path
.
join
(
model_folder
,
'alignment_bench.json'
)]
else
:
raise
FileNotFoundError
all_predictions
=
[]
all_predictions
=
[]
for
json_
in
json_paths
:
for
json_
in
json_paths
:
json_data
=
json
.
load
(
open
(
json_
))
json_data
=
json
.
load
(
open
(
json_
))
...
...
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