MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / loglikelihood

Method loglikelihood

test/general/lm_eval/base.py:26–47  ·  view source on GitHub ↗

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) context: str

(self, requests)

Source from the content-addressed store, hash-verified

24
25 @abstractmethod
26 def loglikelihood(self, requests):
27 """Compute log-likelihood of generating a continuation from a context.
28 Downstream tasks should attempt to use loglikelihood instead of other
29 LM calls whenever possible.
30
31 :param requests: list
32 A list of pairs (context, continuation)
33 context: str
34 Context string. Implementations of LM must be able to handle an
35 empty context string.
36 continuation: str
37 The continuation over which log likelihood will be calculated. If
38 there is a word boundary, the space should be in the continuation.
39 For example, context="hello" continuation=" world" is correct.
40 :return: list
41 A list of pairs (logprob, isgreedy)
42 logprob: float
43 The log probability of `continuation`
44 isgreedy:
45 Whether `continuation` would be generated by greedy sampling from `context`
46 """
47 pass
48
49 @abstractmethod
50 def loglikelihood_rolling(self, requests):

Callers 1

construct_requestsMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected