MCPcopy Create free account
hub / github.com/FunAudioLLM/ThinkSound / sample_top_p

Function sample_top_p

ThinkSound/models/utils.py:71–87  ·  view source on GitHub ↗

Sample next token from top P probabilities along the last dimension of the input probs tensor. Args: probs (torch.Tensor): Input probabilities with token candidates on the last dimension. p (int): The p in “top-p”. Returns: torch.Tensor: Sampled tokens.

(probs: torch.Tensor, p: float)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers

nothing calls this directly

Calls 3

multinomialFunction · 0.85
cumsumMethod · 0.80
sumMethod · 0.80

Tested by

no test coverage detected