artefactual.preprocessing.parse_sampled_token_logprobs#
- artefactual.preprocessing.parse_sampled_token_logprobs(outputs)[source]#
Extract the logprob of each sampled token, ignoring the alternatives.
The counterpart to parse_top_logprobs, which reads the top-k distribution. Neither EPR nor WEPR uses this; it is exposed for callers measuring sequence likelihood.
- Parameters:
outputs (
Any) – A single completion response, as a mapping or an object.- Return type:
- Returns:
One 1-D array per sequence, holding the sampled token logprobs in order.
- Raises:
TypeError – If the output matches no completion format, including a batch line whose body matches none.
ValidationError – If it matches one but carries an invalid field, named by the error pydantic raised.
ValueError – If a batch line carries no completion, because its request failed.