mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-20 02:24:59 +00:00
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:
parent
cae9bf1308
commit
9628860c0e
3 changed files with 41 additions and 44 deletions
|
@ -1,6 +1,8 @@
|
|||
package xsysinfo
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/jaypipes/ghw"
|
||||
"github.com/jaypipes/ghw/pkg/gpu"
|
||||
)
|
||||
|
@ -13,3 +15,19 @@ func GPUs() ([]*gpu.GraphicsCard, error) {
|
|||
|
||||
return gpu.GraphicsCards, nil
|
||||
}
|
||||
|
||||
func HasGPU(vendor string) bool {
|
||||
gpus, err := GPUs()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if vendor == "" {
|
||||
return len(gpus) > 0
|
||||
}
|
||||
for _, gpu := range gpus {
|
||||
if strings.Contains(gpu.String(), vendor) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue