only check system memory on macos
This commit is contained in:
parent
4a8931f634
commit
36fe2deebf
1 changed files with 21 additions and 28 deletions
13
llm/llm.go
13
llm/llm.go
|
@ -56,7 +56,6 @@ func New(workDir, model string, adapters []string, opts api.Options) (LLM, error
|
|||
opts.NumGPU = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var requiredMemory int64
|
||||
var f16Multiplier int64 = 2
|
||||
|
@ -77,18 +76,12 @@ func New(workDir, model string, adapters []string, opts api.Options) (LLM, error
|
|||
|
||||
systemMemory := int64(memory.TotalMemory())
|
||||
|
||||
videoMemory, err := CheckVRAM()
|
||||
if err != nil{
|
||||
videoMemory = 0
|
||||
}
|
||||
|
||||
totalMemory := systemMemory + videoMemory
|
||||
|
||||
if ggml.FileType() == "F16" && requiredMemory*f16Multiplier > totalMemory {
|
||||
if ggml.FileType() == "F16" && requiredMemory*f16Multiplier > systemMemory {
|
||||
return nil, fmt.Errorf("F16 model requires at least %s of total memory", format.HumanBytes(requiredMemory))
|
||||
} else if requiredMemory > totalMemory {
|
||||
} else if requiredMemory > systemMemory {
|
||||
return nil, fmt.Errorf("model requires at least %s of total memory", format.HumanBytes(requiredMemory))
|
||||
}
|
||||
}
|
||||
|
||||
switch ggml.Name() {
|
||||
case "gguf":
|
||||
|
|
Loading…
Add table
Reference in a new issue