Merge pull request #3466 from ollama/mxyng/head-kv

default head_kv to 1
This commit is contained in:
Michael Yang 2024-04-03 10:41:00 -07:00 committed by GitHub
commit 4f895d633f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -148,15 +148,15 @@ func (kv KV) HeadCount() uint64 {
} }
func (kv KV) HeadCountKV() 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 { func (kv KV) GQA() uint64 {
if headCountKV := kv.HeadCountKV(); headCountKV > 0 { return kv.HeadCount() / kv.HeadCountKV()
return kv.HeadCount() / headCountKV
}
return 0
} }
func (kv KV) EmbeddingLength() uint64 { func (kv KV) EmbeddingLength() uint64 {