add max context length check

This commit is contained in:
Michael Yang
2024-01-12 14:54:01 -08:00
parent 565f8a3c44
commit eaed6f8c45
3 changed files with 15 additions and 0 deletions

View File

@@ -308,6 +308,15 @@ func (llm *ggufModel) NumHeadKv() uint32 {
return value.(uint32)
}
func (llm *ggufModel) NumCtx() uint32 {
value, exists := llm.kv[fmt.Sprintf("%s.context_length", llm.ModelFamily())]
if !exists {
return 0
}
return value.(uint32)
}
func (llm *ggufModel) NumGQA() uint32 {
numHeadKv := llm.NumHeadKv()
if numHeadKv == 0 {