Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

Merge pull request #1552 from jmorganca/mxyng/lint-test

Michael Yangf4f939de28aa
diff --cc llm/llm.go
index f7ed09e2f,0ef834b4c..4f709538e
--- a/llm/llm.go
+++ b/llm/llm.go
@@@ -40,16 -41,37 +40,16 @@@ func New(workDir, model string, adapter
opts.NumCtx = 4
}
- fmt.Println("size", ggml.Size)
- fmt.Println("filetype", ggml.FileType())
- fmt.Println("architecture", ggml.ModelFamily())
- fmt.Println("type", ggml.ModelType())
- fmt.Println("name", ggml.Name())
- fmt.Println("embd", ggml.NumEmbed())
- fmt.Println("head", ggml.NumHead())
- fmt.Println("head_kv", ggml.NumHeadKv())
- fmt.Println("gqa", ggml.NumGQA())
-
- available, _ := gpu.CheckVRAM()
-
- // For now assume filesize = model size
- // TODO: use actual model size
- requiredModel := ggml.Size
+ vram, _ := gpu.CheckVRAM()
+ size := ggml.Size
// fp16 k,v matrices require = n_ctx * n_layer * n_embd / n_head * n_head_kv * 2 bytes each * 2 key and value
- requiredKv := 2 * 2 * int64(opts.NumCtx) * int64(ggml.NumLayers()) * int64(ggml.NumEmbed()) * int64(ggml.NumHeadKv()) / int64(ggml.NumHead())
+ kv := 2 * 2 * int64(opts.NumCtx) * int64(ggml.NumLayers()) * int64(ggml.NumEmbed()) * int64(ggml.NumHeadKv()) / int64(ggml.NumHead())
// this amount is the overhead + tensors in memory
- // TODO: get this from the llama.cpp's graph calcluations instead of
+ // TODO: get this from the llama.cpp's graph calculations instead of
// estimating it's 1/6 * kv_cache_size * num_gqa
- requiredAlloc := int64(ggml.NumGQA()) * requiredKv / 6
-
- requiredTotal := requiredModel + requiredKv + requiredAlloc
-
- log.Println("system memory bytes:", available)
- log.Println("required model bytes:", requiredModel)
- log.Println("required kv bytes:", requiredKv)
- log.Println("required alloc bytes:", requiredAlloc)
- log.Println("required total bytes:", requiredTotal)
+ graph := int64(ggml.NumGQA()) * kv / 6
info := gpu.GetGPUInfo()
library := info.Library