docs: def token_perplexity_macro(eval_data, predictions, scores, learner='ignored'):
      '''
      Return the per-token perplexity `exp(-score / num_tokens)` computed from each
      score in `scores.`
  
      The correct macro-average is given by the geometric mean.
  
      >>> refs = [Instance(None, ''),
      ...         Instance(None, ''),
      ...         Instance(None, '2')]
      >>> scores = [np.log(1.0), np.log(0.25), np.log(1 / 64.)]
      >>> perplexities = token_perplexity_macro(refs, None, scores)
      >>> [round(p) for p in perplexities]
      ... # sequence perplexities: [1, 4, 16]
      ... # per-token perplexities: [1, 4, 8]
      [1.0, 4.0, 8.0]
      '''
      lens = np.array([len(_maybe_tokenize(inst.output)) + 1 for inst in eval_data])
      return np.exp(-np.array(scores) / lens).tolist()