mirror of
https://github.com/ollama/ollama.git
synced 2026-02-19 15:57:07 -05:00
Remove static VRAM estimation (EstimateVRAM, CheckMemoryRequirements) which wasn't helpful. Instead, report the actual tensor weight size from the manifest for ollama ps. - Remove memory estimation check from runner startup - Remove EstimateVRAM, CheckMemoryRequirements, modelVRAMEstimates - Add TotalTensorSize() to get actual weight size from manifest - Use weight size for Server.vramSize instead of estimates Note: This is better than showing 0 or inaccurate estimates, but the weight size is a drastic underestimation of actual memory usage since it doesn't account for activations, intermediate tensors, or MLX overhead. Future work should query real-time memory from MLX (e.g., MetalGetActiveMemory) for accurate reporting.
40 lines
835 B
Go
40 lines
835 B
Go
package imagegen
|
|
|
|
import (
|
|
"runtime"
|
|
"testing"
|
|
)
|
|
|
|
func TestCheckPlatformSupport(t *testing.T) {
|
|
err := CheckPlatformSupport()
|
|
|
|
switch runtime.GOOS {
|
|
case "darwin":
|
|
if runtime.GOARCH == "arm64" {
|
|
if err != nil {
|
|
t.Errorf("Expected nil error on darwin/arm64, got: %v", err)
|
|
}
|
|
} else {
|
|
if err == nil {
|
|
t.Error("Expected error on darwin/non-arm64")
|
|
}
|
|
}
|
|
case "linux", "windows":
|
|
if err != nil {
|
|
t.Errorf("Expected nil error on %s, got: %v", runtime.GOOS, err)
|
|
}
|
|
default:
|
|
if err == nil {
|
|
t.Errorf("Expected error on unsupported platform %s", runtime.GOOS)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestResolveModelName(t *testing.T) {
|
|
// Non-existent model should return empty string
|
|
result := ResolveModelName("nonexistent-model")
|
|
if result != "" {
|
|
t.Errorf("ResolveModelName() = %q, want empty string", result)
|
|
}
|
|
}
|