mirror of
https://github.com/ollama/ollama.git
synced 2026-11-10 15:02:13 -06:00
* Add Kev decision scoring to MLX Load Kev models with their FP32 decision head and release metadata. Support System One scoring with shared-state caching and Kev-specific limits. * address comments
31 lines
817 B
Go
31 lines
817 B
Go
package create
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
func kevFileType(inv Inventory) (string, error) {
|
|
// The pointer head is FP32; the text embedding records the backbone dtype.
|
|
var embedding string
|
|
for _, name := range sortedTensorNames(inv) {
|
|
if name != "embed_tokens.weight" && !strings.HasSuffix(name, ".embed_tokens.weight") {
|
|
continue
|
|
}
|
|
if embedding != "" {
|
|
return "", fmt.Errorf("Kev source has multiple text embedding tensors: %q and %q", embedding, name)
|
|
}
|
|
embedding = name
|
|
}
|
|
if embedding == "" {
|
|
return "", fmt.Errorf("Kev source has no text embedding tensor")
|
|
}
|
|
dtype := strings.ToUpper(inv.Tensors[embedding].Dtype)
|
|
switch dtype {
|
|
case "BF16", "F16", "F32":
|
|
return dtype, nil
|
|
default:
|
|
return "", fmt.Errorf("unsupported Kev text embedding dtype %q in %s", dtype, embedding)
|
|
}
|
|
}
|