Documentation
¶
Index ¶
- func CalculateLogprobs(logits []float32, selectedToken int, topK int, decoder TokenDecoderFunc) []llm.Logprob
- func ContainsStopSuffix(sequence string, stops []string) bool
- func FindStop(sequence string, stops []string) (bool, string)
- func IncompleteUnicode(token string) bool
- func TruncateStop(pieces []string, stop string) ([]string, bool)
- type TokenDecoderFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateLogprobs ¶ added in v0.12.11
func CalculateLogprobs(logits []float32, selectedToken int, topK int, decoder TokenDecoderFunc) []llm.Logprob
CalculateLogprobs converts raw logits to log probabilities and finds top K tokens. It uses numerically stable softmax to compute log probabilities.
func ContainsStopSuffix ¶
func IncompleteUnicode ¶
Types ¶
type TokenDecoderFunc ¶ added in v0.12.11
TokenDecoderFunc is a function that converts token IDs to text.
Click to show internal directories.
Click to hide internal directories.