Versions in this module Expand all Collapse all v1 v1.3.1 Jul 21, 2026 v1.3.0 Jul 20, 2026 v1.2.0 Jun 29, 2026 v1.1.2 Mar 15, 2026 Changes in this version type SafeTensors + func (s *SafeTensors) Free() v1.1.1 Mar 5, 2026 Changes in this version type Block + func (block *Block) ForwardNext(cache *neural.KVCacheBlock, in *tensor.Tensor) *tensor.Tensor type Model + func (m *Model) ForwardNext(cache *neural.KVCache, token int, predict bool) *tensor.Tensor v1.1.0 Mar 1, 2026 Changes in this version + func ArgMaxLastToken(logits *tensor.Tensor, b int) int + func EnsureFile(remote, local string, size int64) + func GPT2() + func SampleTopKLast(logits *tensor.Tensor, b int, temperature float32, k int, rng *rand.Rand) int + type Block struct + Attn *neural.Attention + D int + LN1 *neural.LayerNorm + LN2 *neural.LayerNorm + MLP *MLP + func NewBlock(d, heads int, eps float32, causal bool) *Block + func (b *Block) Forward(x *tensor.Tensor, tape neural.Tape) (*tensor.Tensor, neural.Tape) + type MLP struct + CFC *neural.Linear + CProj *neural.Linear + D int + Hidden int + func NewMLP(d int) *MLP + func (m *MLP) Forward(x *tensor.Tensor, tape neural.Tape) (*tensor.Tensor, neural.Tape) + type Model struct + Blocks []*Block + ContextSize int + DropP float32 + EmbeddingSize int + Eps float32 + Heads int + LMHead *neural.Linear + LNF *neural.LayerNorm + Layers int + VocabSize int + WPE *neural.PositionEmbeddings + WTE *neural.Embeddings + func NewModel(p *ModelParams) *Model + func (m *Model) Forward(tokens [][]int, tape neural.Tape) (*tensor.Tensor, neural.Tape) + func (m *Model) Load(weightsFile string) error + type ModelParams struct + ContextSize int + EmbeddingSize int + Eps float32 + Heads int + Layers int + VocabSize int + type SafeTensors struct + func LoadSafeTensors(path string) (*SafeTensors, error) + func (s *SafeTensors) Get(key string) (*tensor.Tensor, error) + type Tokenizer struct + InvVocab []string + Vocab map[string]int + func NewTokenizer(vocabFile string) (*Tokenizer, error) + func (t *Tokenizer) DebugSample(n int) + func (t *Tokenizer) Decode(ids []int) string + func (t *Tokenizer) DecodeID(id int) string + func (t *Tokenizer) EncodeID(token string) (int, bool) + type Top struct + ID int + Logit float32 + func TopKLastToken(logits *tensor.Tensor, b int, k int) []Top