Documentation ¶
Index ¶
- Constants
- Variables
- func Colorize(format string, opts ...interface{}) (n int, err error)
- func Eval(lctx *Context, tokens []uint32, tokensCount uint32, pastCount uint32, ...) error
- func Resize(slice []float32, size int) []float32
- func ResizeInplace(slice *[]float32, size int)
- func SampleTopPTopK(lctx *Context, lastNTokens []uint32, lastNTokensSize uint32, topK uint32, ...) uint32
- type Context
- type ContextParams
- type HParams
- type KVCache
- type Layer
- type Model
- type ModelType
Constants ¶
View Source
const ( LLAMA_FILE_VERSION = 1 LLAMA_FILE_MAGIC = 0x67676a74 // 'ggjt' in hex LLAMA_FILE_MAGIC_OLD = 0x67676d66 // 'ggmf' in hex LLAMA_FILE_MAGIC_UNVERSIONED = 0x67676d6c // 'ggml' pre-versioned files )
Variables ¶
View Source
var ( // determine number of model parts based on the dimension LLAMA_N_PARTS = map[uint32]uint32{ 4096: 1, 5120: 2, 6656: 4, 8192: 8, } )
Functions ¶
func Resize ¶
Safe Resize() for using instead of C++ std::vector:resize() https://go.dev/play/p/VlQ7N75E5AD
func ResizeInplace ¶
NB! This do not clear the underlying array when resizing https://go.dev/play/p/DbK4dFqwrZn
Types ¶
type Context ¶
type Context struct { Model *Model Vocab *ml.Vocab // decode output (2-dimensional array: [n_tokens][n_vocab]) Logits []float32 LogitsAll bool // input embedding (1-dimensional array: [n_embd]) Embedding []float32 }
func NewContext ¶
func NewContext() *Context
type ContextParams ¶
type ContextParams struct { CtxSize uint32 // text context PartsCount int // -1 for default Seed int // RNG seed, 0 for random LogitsAll bool // the llama_eval() call computes all logits, not just the last one VocabOnly bool // only load the vocabulary, no weights UseLock bool // force system to keep model in RAM Embedding bool // embedding mode only }
struct llama_context_params {
type HParams ¶
type HParams struct {
// contains filtered or unexported fields
}
default hparams (LLaMA 7B)
Click to show internal directories.
Click to hide internal directories.