Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

ram is always null in /api/resources ("My Machine" panel) whenever a GPU is present

未关闭 适合新手
#12,834 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@bercedev 已经在做这个了。

开始于 2026年10月23日。

  • #12861 来自 @bercedev —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
go
领域
api, backend

调研方向

从pkg/xsysinfo/gpu.go开始,检查GetResourceInfo()以及无GPU分支中现有的GetSystemRAMInfo()调用。返回GPU详细信息时,确保主机RAM仍有值,并与Aggregate中的VRAM同时保留;检查资源端点或相关测试,确认存在GPU时/api/resources返回非null的ram。

由索引模型根据 Issue 内容生成。

描述

LocalAI version

v4.12.0 (15e37df9a468c798a5a511624f054057da4380a1), image localai/localai:latest-gpu-nvidia-cuda-13

Environment, CPU architecture, OS, and Version
  • Docker on Linux (Ubuntu), host: Intel i9-14900KF (32 threads), 188GB RAM, NVIDIA RTX 4060 Ti (16GB VRAM)
  • nvidia-container-toolkit 1.20.1, --gpus all
  • Confirmed the container has full, correct visibility into host RAM (free -h and /proc/meminfo both report the real 188GB inside the container, cgroup memory.max is max/unlimited)
Describe the bug

The "My Machine" panel in the web UI shows GPU, CPU, and disk info correctly, but RAM shows no data. Hitting the backend endpoint directly confirms it:

$ curl -s http://localhost:8080/api/resources
{"aggregate":{"total_memory":17175674880,...},"cpu":{...},"disk":{...},"gpus":[{...}],"ram":null,...}

ram is always null whenever a GPU is present. Tracing this through the source, it looks intentional rather than a detection failure: in pkg/xsysinfo/gpu.go, GetResourceInfo() takes a GPU-present branch that returns RAM: nil and instead reports VRAM totals under Aggregate, and only calls GetSystemRAMInfo() to populate RAM in the no-GPU fallback branch:

if <GPU detected> {
    return &Resources{
        RAM: nil,
        Aggregate: AggregateMemoryInfo{
            TotalMemory: aggregate.TotalVRAM,
            ...
        },
    }
}
// No GPU - fall back to system RAM
ramInfo, _ := GetSystemRAMInfo()
return &Resources{RAM: ramInfo, ...}

This means any machine with a GPU can never see host RAM info in /api/resources or the "My Machine" panel, even though the data is trivially available (GetSystemRAMInfo() already works correctly, as shown by the no-GPU branch using it).

To reproduce
  1. Run LocalAI with --gpus all on any machine with an NVIDIA GPU.
  2. Open the web UI → "My Machine" (or curl localhost:8080/api/resources).
  3. Observe GPU/CPU/disk are populated but ram is null.
Expected behavior

RAM should be populated alongside VRAM when a GPU is present — both are useful for sizing models (e.g. offloaded layers running on CPU RAM, or deciding how many models to keep warm), not just VRAM.

Additional context

Happy to test a fix — my setup bind-mounts /models, /backends, /configuration, /data onto a RAID0 NVMe array if that's a useful data point, though it doesn't seem related to this particular issue.

主要语言
Go
星标
49.8k
派生
4.5k
平均合并
20 小时 11 分钟
30 天内合并 PR
350

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

mudler/LocalAI 的其他 Issue

查看 mudler/LocalAI 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。