feat(llama.cpp/clip): inject gpu options if we detect GPUs (#5243)

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto 2025-04-26 00:04:47 +02:00 committed by GitHub
parent cae9bf1308
commit 9628860c0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 41 additions and 44 deletions

View file

@ -4,6 +4,7 @@ import (
"os"
"path/filepath"
"github.com/mudler/LocalAI/pkg/xsysinfo"
"github.com/rs/zerolog/log"
gguf "github.com/thxcode/gguf-parser-go"
)
@ -35,4 +36,10 @@ func guessDefaultsFromFile(cfg *BackendConfig, modelPath string, defaultCtx int)
}
cfg.ContextSize = &defaultCtx
}
if cfg.Options == nil {
if xsysinfo.HasGPU("nvidia") || xsysinfo.HasGPU("amd") {
cfg.Options = []string{"gpu"}
}
}
}