in neuron-explainer/neuron_explainer/explanations/simulator.py [0:0]
def parse_top_logprobs(top_logprobs: dict[str, float]) -> OrderedDict[int, float]:
"""
Given a map from tokens to logprobs, return a map from distribution values (integers on the
range [0, 10]) to unnormalized probabilities (in the sense that they may not sum to 1).
"""
probabilities_by_distribution_value = OrderedDict()
for token, logprob in top_logprobs.items():
if token in VALID_ACTIVATION_TOKENS:
token_as_int = int(token)
probabilities_by_distribution_value[token_as_int] = np.exp(logprob)
return probabilities_by_distribution_value