Documentation ¶
Index ¶
- func Argmax(v []float32) int
- func Sample(seed uint64, probabilities []float32) int
- func Softmax(x []float32)
- func Transformer(token, pos int, c Checkpoint, s *RunState)
- type Checkpoint
- type Config
- type MmapCheckpoint
- func (c *MmapCheckpoint) Close() error
- func (c *MmapCheckpoint) Dim() int
- func (c *MmapCheckpoint) Error() error
- func (c *MmapCheckpoint) FreqCisImag(pos int) []float32
- func (c *MmapCheckpoint) FreqCisReal(pos int) []float32
- func (c *MmapCheckpoint) HiddenDim() int
- func (c *MmapCheckpoint) NHeads() int
- func (c *MmapCheckpoint) NKvHeads() int
- func (c *MmapCheckpoint) NLayers() int
- func (c *MmapCheckpoint) RmsAttWeight(layer int) []float32
- func (c *MmapCheckpoint) RmsFfnWeight(layer int) []float32
- func (c *MmapCheckpoint) RmsFinalWeight() []float32
- func (c *MmapCheckpoint) SeqLen() int
- func (c *MmapCheckpoint) TokenEmbeddingTable(token int) []float32
- func (c *MmapCheckpoint) VocabSize() int
- func (c *MmapCheckpoint) W1(layer int) []float32
- func (c *MmapCheckpoint) W2(layer int) []float32
- func (c *MmapCheckpoint) W3(layer int) []float32
- func (c *MmapCheckpoint) Wcls() []float32
- func (c *MmapCheckpoint) Wk(layer int) []float32
- func (c *MmapCheckpoint) Wo(layer int) []float32
- func (c *MmapCheckpoint) Wq(layer int) []float32
- func (c *MmapCheckpoint) Wv(layer int) []float32
- type RunState
- type Vocab
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Transformer ¶
func Transformer(token, pos int, c Checkpoint, s *RunState)
Types ¶
type Checkpoint ¶
type Checkpoint interface { Error() error Close() error Dim() int HiddenDim() int NLayers() int NHeads() int NKvHeads() int VocabSize() int SeqLen() int TokenEmbeddingTable(token int) []float32 RmsAttWeight(layer int) []float32 RmsFfnWeight(layer int) []float32 Wq(layer int) []float32 Wk(layer int) []float32 Wv(layer int) []float32 Wo(layer int) []float32 W1(layer int) []float32 W2(layer int) []float32 W3(layer int) []float32 RmsFinalWeight() []float32 FreqCisReal(pos int) []float32 FreqCisImag(pos int) []float32 Wcls() []float32 }
type MmapCheckpoint ¶
type MmapCheckpoint struct {
// contains filtered or unexported fields
}
func NewMmapCheckpoint ¶
func NewMmapCheckpoint(pathname string) (*MmapCheckpoint, error)
func (*MmapCheckpoint) Close ¶
func (c *MmapCheckpoint) Close() error
func (*MmapCheckpoint) Dim ¶
func (c *MmapCheckpoint) Dim() int
func (*MmapCheckpoint) Error ¶
func (c *MmapCheckpoint) Error() error
func (*MmapCheckpoint) FreqCisImag ¶
func (c *MmapCheckpoint) FreqCisImag(pos int) []float32
func (*MmapCheckpoint) FreqCisReal ¶
func (c *MmapCheckpoint) FreqCisReal(pos int) []float32
func (*MmapCheckpoint) HiddenDim ¶
func (c *MmapCheckpoint) HiddenDim() int
func (*MmapCheckpoint) NHeads ¶
func (c *MmapCheckpoint) NHeads() int
func (*MmapCheckpoint) NKvHeads ¶
func (c *MmapCheckpoint) NKvHeads() int
func (*MmapCheckpoint) NLayers ¶
func (c *MmapCheckpoint) NLayers() int
func (*MmapCheckpoint) RmsAttWeight ¶
func (c *MmapCheckpoint) RmsAttWeight(layer int) []float32
func (*MmapCheckpoint) RmsFfnWeight ¶
func (c *MmapCheckpoint) RmsFfnWeight(layer int) []float32
func (*MmapCheckpoint) RmsFinalWeight ¶
func (c *MmapCheckpoint) RmsFinalWeight() []float32
func (*MmapCheckpoint) SeqLen ¶
func (c *MmapCheckpoint) SeqLen() int
func (*MmapCheckpoint) TokenEmbeddingTable ¶
func (c *MmapCheckpoint) TokenEmbeddingTable(token int) []float32
func (*MmapCheckpoint) VocabSize ¶
func (c *MmapCheckpoint) VocabSize() int
func (*MmapCheckpoint) W1 ¶
func (c *MmapCheckpoint) W1(layer int) []float32
func (*MmapCheckpoint) W2 ¶
func (c *MmapCheckpoint) W2(layer int) []float32
func (*MmapCheckpoint) W3 ¶
func (c *MmapCheckpoint) W3(layer int) []float32
func (*MmapCheckpoint) Wcls ¶
func (c *MmapCheckpoint) Wcls() []float32
func (*MmapCheckpoint) Wk ¶
func (c *MmapCheckpoint) Wk(layer int) []float32
func (*MmapCheckpoint) Wo ¶
func (c *MmapCheckpoint) Wo(layer int) []float32
func (*MmapCheckpoint) Wq ¶
func (c *MmapCheckpoint) Wq(layer int) []float32
func (*MmapCheckpoint) Wv ¶
func (c *MmapCheckpoint) Wv(layer int) []float32
Click to show internal directories.
Click to hide internal directories.