count all vision tensors
This commit is contained in:
parent
033cec232a
commit
d2ec22371e
@ -579,12 +579,16 @@ func (f GGML) GraphSize(context, batch uint64, kvCacheType string) (kv, partialO
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (llm GGML) VisionGraphSize() (weights, graphSize uint64) {
|
func (llm GGML) VisionGraphSize() (weights, graphSize uint64) {
|
||||||
|
for name, layer := range llm.Tensors().GroupLayers() {
|
||||||
|
if strings.HasPrefix(name, "v.") {
|
||||||
|
for _, tensor := range layer {
|
||||||
|
weights += tensor.Size()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch llm.KV().Architecture() {
|
switch llm.KV().Architecture() {
|
||||||
case "mllama":
|
case "mllama":
|
||||||
for _, layer := range llm.Tensors().GroupLayers()["v"] {
|
|
||||||
weights += layer.Size()
|
|
||||||
}
|
|
||||||
|
|
||||||
kv := func(n string) uint64 {
|
kv := func(n string) uint64 {
|
||||||
if v, ok := llm.KV()["mllama.vision."+n].(uint32); ok {
|
if v, ok := llm.KV()["mllama.vision."+n].(uint32); ok {
|
||||||
return uint64(v)
|
return uint64(v)
|
||||||
@ -611,15 +615,8 @@ func (llm GGML) VisionGraphSize() (weights, graphSize uint64) {
|
|||||||
embeddingLength*numPatches*maxNumTiles +
|
embeddingLength*numPatches*maxNumTiles +
|
||||||
9*embeddingLength*numPaddedPatches*maxNumTiles +
|
9*embeddingLength*numPaddedPatches*maxNumTiles +
|
||||||
numPaddedPatches*maxNumTiles*numPaddedPatches*maxNumTiles*headCount)
|
numPaddedPatches*maxNumTiles*numPaddedPatches*maxNumTiles*headCount)
|
||||||
case "gemma3":
|
|
||||||
for name, layer := range llm.Tensors().GroupLayers() {
|
|
||||||
if strings.HasPrefix(name, "v.") {
|
|
||||||
for _, tensor := range layer {
|
|
||||||
weights += tensor.Size()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return weights, graphSize
|
return weights, graphSize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user