sample: separate softmax and temperature transforms (#9732)

This commit is contained in:
Parth Sareen
2025-03-13 09:53:27 -07:00
committed by GitHub
parent 4aeb67ef4c
commit 5c0b663969
3 changed files with 98 additions and 25 deletions

View File

@@ -87,8 +87,8 @@ func (s *Sampler) sample(tokens []token) (token, error) {
// topK also sorts the tokens in descending order of logits
tokens = topK(tokens, s.topK)
// token logit values are updated to probabilities
tokens = temperature(tokens, s.temperature)
tokens = softmax(tokens)
tokens = topP(tokens, s.topP)
tokens = minP(tokens, s.minP)