Skip to content

Commit

Permalink
Merge pull request ollama#3466 from ollama/mxyng/head-kv
Browse files Browse the repository at this point in the history
default head_kv to 1
  • Loading branch information
mxyng authored Apr 3, 2024
2 parents 7d05a6e + 90f071c commit 4f895d6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions llm/ggml.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ func (kv KV) HeadCount() uint64 {
}

func (kv KV) HeadCountKV() uint64 {
return kv.u64(fmt.Sprintf("%s.attention.head_count_kv", kv.Architecture()))
if headCountKV := kv.u64(fmt.Sprintf("%s.attention.head_count_kv", kv.Architecture())); headCountKV > 0 {
return headCountKV
}

return 1
}

func (kv KV) GQA() uint64 {
if headCountKV := kv.HeadCountKV(); headCountKV > 0 {
return kv.HeadCount() / headCountKV
}

return 0
return kv.HeadCount() / kv.HeadCountKV()
}

func (kv KV) EmbeddingLength() uint64 {
Expand Down

0 comments on commit 4f895d6

Please sign in to comment.