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
525b8f5d
Unverified
Commit
525b8f5d
authored
Mar 06, 2024
by
Hailey Schoelkopf
Committed by
GitHub
Mar 06, 2024
Browse files
Update docs on LM.loglikelihood_rolling abstract method (#1532)
parent
faee1adf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
lm_eval/api/model.py
lm_eval/api/model.py
+6
-8
No files found.
lm_eval/api/model.py
View file @
525b8f5d
...
@@ -54,7 +54,7 @@ class LM(abc.ABC):
...
@@ -54,7 +54,7 @@ class LM(abc.ABC):
pass
pass
@
abc
.
abstractmethod
@
abc
.
abstractmethod
def
loglikelihood_rolling
(
self
,
requests
)
->
List
[
Tuple
[
float
,
bool
]]:
def
loglikelihood_rolling
(
self
,
requests
)
->
List
[
Tuple
[
float
]]:
"""Compute full log-likelihood of a string, with no truncation, for perplexity computation
"""Compute full log-likelihood of a string, with no truncation, for perplexity computation
- We will use the full max context length of the model.
- We will use the full max context length of the model.
- For inputs that exceed the max context length, we divide the tokenized string into chunks of up to
- For inputs that exceed the max context length, we divide the tokenized string into chunks of up to
...
@@ -83,15 +83,13 @@ class LM(abc.ABC):
...
@@ -83,15 +83,13 @@ class LM(abc.ABC):
2. For the last pair, we provide the full context, but only score the last two tokens
2. For the last pair, we provide the full context, but only score the last two tokens
:param requests: list[Instance]
:param requests: list[Instance]
A list of Instance objects with property `args` which returns a tuple (context,
continuation
).
A list of Instance objects with property `args` which returns a tuple (context,).
string: str
string: str
String for which we are computing
per-token
loglikelihood
String for which we are computing
overall
loglikelihood
:return: list[tuple[float
, bool
]]
:return: list[tuple[float]]
A list of
pair
s (logprob,
isgreedy
)
A list of
tuple
s (logprob,)
logprob: float
logprob: float
The log probability of `continuation`
The log probability of `context` conditioned on the EOT token.
isgreedy:
Whether `continuation` would be generated by greedy sampling from `context`
"""
"""
pass
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