sample

package
v0.5.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2025 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MinP

type MinP float64

func (MinP) Apply added in v0.5.13

func (p MinP) Apply(logits []float64) []float64

type Sampler

type Sampler interface {
	Sample([]float32) (int32, error)
}

func Greedy

func Greedy() Sampler

func NewSampler added in v0.5.13

func NewSampler(temperature float32, topK int, topP float32, minP float32, seed int) (Sampler, error)

TODO(parthsareen): update sampler interface to use json unmarshal https://github.com/ollama/ollama/issues/9278

func Weighted added in v0.5.13

func Weighted(seed *uint64, transforms ...Transform) Sampler

TODO(parthsareen): remove uv sample dependency https://github.com/ollama/ollama/issues/9279

type Temperature

type Temperature float64

func (Temperature) Apply added in v0.5.13

func (t Temperature) Apply(logits []float64) []float64

type TopK

type TopK int

func (TopK) Apply added in v0.5.13

func (k TopK) Apply(logits []float64) []float64

TODO(parthsareen): avoid having to check all logits after this transform

type TopP

type TopP float64

func (TopP) Apply added in v0.5.13

func (p TopP) Apply(logits []float64) []float64

type Transform added in v0.5.13

type Transform interface {
	Apply([]float64) []float64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL