arthurai.core.model_utils.tensors_to_arthur_inference#

arthurai.core.model_utils.tensors_to_arthur_inference(log_tensor, id_to_vocab, num_probs)#

Convert an array of log probabilities with shape (sequence length, vocab size) to an Arthur Token Likelihoods formatted object.

Parameters
  • log_tensor (array) – array of log probabilities for a generated sequence

  • id_to_vocab (Dict[int, str]) – mapping from token ids to vocab strings

  • num_probs (int) – the number of tokens at each index in the sequence to include (up to 5)

Return type

List[Dict[str, float]]