mirror of
https://github.com/mudler/LocalAI.git
synced 2025-06-24 03:35:00 +00:00
feat(backend gallery): add meta packages
So we can have meta packages such as "vllm" that automatically installs the corresponding package depending on the GPU that is being currently detected in the system. Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
be3ff482d0
commit
9a34fc8c66
4 changed files with 346 additions and 13 deletions
40
core/system/capabilities.go
Normal file
40
core/system/capabilities.go
Normal file
|
@ -0,0 +1,40 @@
|
|||
package system
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/mudler/LocalAI/pkg/xsysinfo"
|
||||
)
|
||||
|
||||
type SystemState struct {
|
||||
GPUVendor string
|
||||
}
|
||||
|
||||
func GetSystemState() (*SystemState, error) {
|
||||
gpuVendor, err := detectGPUVendor()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SystemState{GPUVendor: gpuVendor}, nil
|
||||
}
|
||||
|
||||
func detectGPUVendor() (string, error) {
|
||||
gpus, err := xsysinfo.GPUs()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
for _, gpu := range gpus {
|
||||
if strings.ToUpper(gpu.DeviceInfo.Vendor.Name) == "NVIDIA" {
|
||||
return "nvidia", nil
|
||||
}
|
||||
if strings.ToUpper(gpu.DeviceInfo.Vendor.Name) == "AMD" {
|
||||
return "amd", nil
|
||||
}
|
||||
if strings.ToUpper(gpu.DeviceInfo.Vendor.Name) == "INTEL" {
|
||||
return "intel", nil
|
||||
}
|
||||
}
|
||||
|
||||
return "", nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue