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

Method loglikelihood

test/general/lm_eval/base.py:212–225  ·  view source on GitHub ↗
(self, requests)

Source from the content-addressed store, hash-verified

210 return context_enc, continuation_enc
211
212 def loglikelihood(self, requests):
213 new_reqs = []
214 for context, continuation in requests:
215 if context == "":
216 # end of text as context
217 context_enc, continuation_enc = [self.eot_token_id], self.tok_encode(
218 continuation
219 )
220 else:
221 context_enc, continuation_enc = self._encode_pair(context, continuation)
222
223 new_reqs.append(((context, continuation), context_enc, continuation_enc))
224
225 return self._loglikelihood_tokens(new_reqs)
226
227 def loglikelihood_rolling(self, requests):
228 # TODO: Implement caching once we've confirmed the perplexity implementation

Callers

nothing calls this directly

Calls 3

tok_encodeMethod · 0.95
_encode_pairMethod · 0.95
_loglikelihood_tokensMethod · 0.95

Tested by

no test coverage detected