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
a9fe09e5
Commit
a9fe09e5
authored
Jan 05, 2021
by
Leo Gao
Browse files
Update interface
parent
ea7c5a2c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
lm_eval/base.py
lm_eval/base.py
+16
-3
No files found.
lm_eval/base.py
View file @
a9fe09e5
...
...
@@ -6,7 +6,9 @@ import collections
class
LM
(
abc
.
ABC
):
@
abc
.
abstractmethod
def
loglikelihood
(
self
,
requests
):
"""Compute log-likelihood of generating a continuation from a context
"""Compute log-likelihood of generating a continuation from a context.
Downstream tasks should attempt to use loglikelihood instead of other
LM calls whenever possible.
:param requests: list
A list of pairs (context, continuation)
...
...
@@ -35,7 +37,7 @@ class LM(abc.ABC):
Context string
until: str
The string sequence to generate until. This string sequence may
span across m
s
ultiple tokens, or may be part of one token.
span across multiple tokens, or may be part of one token.
:return: list
A list of strings continuation
continuation: str
...
...
@@ -112,7 +114,13 @@ class Dataset(abc.ABC):
pass
@
abc
.
abstractmethod
def
construct_requests
(
self
,
doc
,
nshot
=
0
,
prompt
=
False
):
def
construct_requests
(
self
,
ctx
):
""" Uses RequestFactory to construct Requests and returns an iterable of
Requests which will be sent to the LM.
:param ctx: str
The context string, generated by fewshot_context.
"""
pass
@
abc
.
abstractmethod
...
...
@@ -134,6 +142,11 @@ class Dataset(abc.ABC):
aggregates them into one float. This should be the same for all
submetrics of the same name; if it differs, an error should be
raised.
:param doc:
The document as returned from training_docs, validation_docs, or test_docs.
:param results:
The results of the requests created in construct_requests.
"""
pass
...
...
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