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
376855d5
Commit
376855d5
authored
Nov 27, 2021
by
Jonathan Tow
Browse files
Loosen tolerances that were intended for `float64` values
parent
377a4fe2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
tests/test_version_stable.py
tests/test_version_stable.py
+5
-1
No files found.
tests/test_version_stable.py
View file @
376855d5
...
...
@@ -16,7 +16,11 @@ def assert_target(name, ob):
fname
=
f
"tests/testdata/
{
name
}
.json"
if
os
.
path
.
exists
(
fname
):
with
open
(
fname
)
as
fh
:
assert
flatten
(
json
.
load
(
fh
))
==
pytest
.
approx
(
flatten
(
json
.
loads
(
json
.
dumps
(
ob
,
sort_keys
=
True
))))
# Use relative tolerance of 1e-5 and absolute tolerance of 1e-8
# assuming most metrics work on `float32` values, which is the common
# default floating type across popular libraries (PyTorch, Tensorflow, and JAX).
assert
flatten
(
json
.
load
(
fh
))
==
pytest
.
approx
(
flatten
(
json
.
loads
(
json
.
dumps
(
ob
,
sort_keys
=
True
))),
rel
=
1e-5
,
abs
=
1e-8
)
else
:
with
open
(
fname
,
'w'
)
as
fh
:
json
.
dump
(
ob
,
fh
,
sort_keys
=
True
)
...
...
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