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
dbbc613f
Commit
dbbc613f
authored
Aug 17, 2023
by
baberabb
Browse files
added tolerance for likelihood, rolling
parent
b9df9fb4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
tests/models/test_huggingface.py
tests/models/test_huggingface.py
+4
-2
No files found.
tests/models/test_huggingface.py
View file @
dbbc613f
from
__future__
import
annotations
import
pytest
import
numpy
as
np
from
lm_eval.models.huggingface
import
HFLM
from
lm_eval.api.instance
import
Instance
import
lm_eval.tasks
as
tasks
...
...
@@ -88,7 +89,8 @@ class Test_HFLM:
def
test_logliklihood
(
self
)
->
None
:
res
=
self
.
LM
.
loglikelihood
(
self
.
MULTIPLE_CH
)
assert
res
==
self
.
MULTIPLE_CH_RES
_RES
,
_res
=
[
r
[
0
]
for
r
in
self
.
MULTIPLE_CH_RES
],
[
r
[
0
]
for
r
in
res
]
assert
np
.
allclose
(
_res
[
0
],
_RES
[
0
],
atol
=
1e-3
)
def
test_greedy_until
(
self
)
->
None
:
res
=
self
.
LM
.
greedy_until
(
self
.
GREEDY_UNTIL
)
...
...
@@ -96,7 +98,7 @@ class Test_HFLM:
def
test_logliklihood_rolling
(
self
)
->
None
:
res
=
self
.
LM
.
loglikelihood_rolling
(
self
.
ROLLING
)
assert
res
==
self
.
ROLLING_RES
assert
np
.
allclose
(
res
,
self
.
ROLLING_RES
,
atol
=
1e-2
)
def
test_toc_encode
(
self
)
->
None
:
res
=
self
.
LM
.
tok_encode
(
"foo bar"
)
...
...
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