mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-20 10:35:01 +00:00
fix(gpu): do not assume gpu being returned has node and mem (#5310)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
b2f9fc870b
commit
72111c597d
2 changed files with 5 additions and 3 deletions
|
@ -170,7 +170,7 @@ func guessGGUFFromFile(cfg *BackendConfig, f *gguf.GGUFFile, defaultCtx int) {
|
||||||
vram, err := xsysinfo.TotalAvailableVRAM()
|
vram, err := xsysinfo.TotalAvailableVRAM()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Msgf("guessDefaultsFromFile(TotalAvailableVRAM): %s", err)
|
log.Error().Msgf("guessDefaultsFromFile(TotalAvailableVRAM): %s", err)
|
||||||
} else {
|
} else if vram > 0 {
|
||||||
estimate, err := xsysinfo.EstimateGGUFVRAMUsage(f, vram)
|
estimate, err := xsysinfo.EstimateGGUFVRAMUsage(f, vram)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Msgf("guessDefaultsFromFile(EstimateGGUFVRAMUsage): %s", err)
|
log.Error().Msgf("guessDefaultsFromFile(EstimateGGUFVRAMUsage): %s", err)
|
||||||
|
|
|
@ -24,8 +24,10 @@ func TotalAvailableVRAM() (uint64, error) {
|
||||||
|
|
||||||
var totalVRAM uint64
|
var totalVRAM uint64
|
||||||
for _, gpu := range gpus {
|
for _, gpu := range gpus {
|
||||||
if gpu.Node.Memory.TotalUsableBytes > 0 {
|
if gpu != nil && gpu.Node != nil && gpu.Node.Memory != nil {
|
||||||
totalVRAM += uint64(gpu.Node.Memory.TotalUsableBytes)
|
if gpu.Node.Memory.TotalUsableBytes > 0 {
|
||||||
|
totalVRAM += uint64(gpu.Node.Memory.TotalUsableBytes)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue