mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-11 08:17:03 +00:00
sample: do all sorting in topK
This commit is contained in:
committed by
Parth Sareen
parent
3ba91634c1
commit
4aeb67ef4c
@@ -84,11 +84,8 @@ func (s *Sampler) sample(tokens []token) (token, error) {
|
||||
return greedy(tokens), nil
|
||||
}
|
||||
|
||||
if s.topK > 0 {
|
||||
tokens = topK(tokens, s.topK)
|
||||
} else {
|
||||
sortLogits(tokens)
|
||||
}
|
||||
// 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)
|
||||
|
||||
Reference in New Issue
Block a user