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
dfc47bd5
Commit
dfc47bd5
authored
Sep 06, 2023
by
baberabb
Browse files
changed atol
parent
e0311cd5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
tests/models/test_huggingface.py
tests/models/test_huggingface.py
+5
-3
No files found.
tests/models/test_huggingface.py
View file @
dfc47bd5
...
@@ -95,12 +95,14 @@ class Test_HFLM:
...
@@ -95,12 +95,14 @@ class Test_HFLM:
res
=
self
.
LM
.
loglikelihood
(
self
.
MULTIPLE_CH
)
res
=
self
.
LM
.
loglikelihood
(
self
.
MULTIPLE_CH
)
_RES
,
_res
=
self
.
MULTIPLE_CH_RES
,
[
r
[
0
]
for
r
in
res
]
_RES
,
_res
=
self
.
MULTIPLE_CH_RES
,
[
r
[
0
]
for
r
in
res
]
# log samples to CI
# log samples to CI
file_path
=
Path
(
f
"test_logs/outputs_log_
{
self
.
version_minor
}
.txt"
)
dir_path
=
Path
(
"test_logs"
)
file_path
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
dir_path
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
file_path
=
dir_path
/
f
"outputs_log_
{
self
.
version_minor
}
.txt"
file_path
=
file_path
.
resolve
()
file_path
=
file_path
.
resolve
()
with
open
(
file_path
,
"w"
)
as
f
:
with
open
(
file_path
,
"w"
)
as
f
:
f
.
write
(
"
\n
"
.
join
(
str
(
x
)
for
x
in
_res
))
f
.
write
(
"
\n
"
.
join
(
str
(
x
)
for
x
in
_res
))
assert
np
.
allclose
(
_res
,
_RES
,
atol
=
1e-
4
)
assert
np
.
allclose
(
_res
,
_RES
,
atol
=
1e-
2
)
# check indices for Multiple Choice
# check indices for Multiple Choice
argmax_RES
,
argmax_res
=
np
.
argmax
(
argmax_RES
,
argmax_res
=
np
.
argmax
(
np
.
array
(
_RES
).
reshape
(
-
1
,
4
),
axis
=
1
np
.
array
(
_RES
).
reshape
(
-
1
,
4
),
axis
=
1
...
...
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