sample

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 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 Grammar added in v0.6.0

type Grammar struct {
	// contains filtered or unexported fields
}

func NewGrammar added in v0.6.0

func NewGrammar(vocab *Vocab, grammar string) (*Grammar, error)

func (*Grammar) Accept added in v0.6.0

func (g *Grammar) Accept(token int32)

func (*Grammar) Apply added in v0.6.0

func (g *Grammar) Apply(tokens []token)

type Sampler

type Sampler struct {
	// contains filtered or unexported fields
}

func NewSampler added in v0.5.13

func NewSampler(temperature float32, topK int, topP float32, minP float32, seed int, grammar *Grammar) Sampler

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

func (*Sampler) Sample

func (s *Sampler) Sample(logits []float32) (int32, error)

type Vocab added in v0.6.0

type Vocab struct {
	// contains filtered or unexported fields
}

func NewVocab added in v0.6.0

func NewVocab(path string) *Vocab

func (*Vocab) Load added in v0.6.0

func (v *Vocab) Load() (*llama.Vocab, error)

Load returns the lazily-loaded vocabulary

Jump to

Keyboard shortcuts

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