ollama 添加标志以忽略超出内存消耗

3pvhb19x  于 2个月前  发布在  其他
关注(0)|答案(1)|浏览(24)

我希望有一个标志来忽略这个条件
e9f7f36的ollama/llm/server.go文件中,第128行到第135行:

if runtime.GOOS == "linux" {
    systemMemoryRequired := estimate.TotalSize - estimate.VRAMSize
    available := systemFreeMemory + systemSwapFreeMemory
    if systemMemoryRequired > available {
        slog.Warn("model request too large for system", "requested", format.HumanBytes2(systemMemoryRequired), "available", available, "total", format.HumanBytes2(systemTotalMemory), "free", format.HumanBytes2(systemFreeMemory), "swap", format.HumanBytes2(systemSwapFreeMemory))
        return nil, fmt.Errorf("model requires more system memory (%s) than is available (%s)", format.HumanBytes2(systemMemoryRequired), format.HumanBytes2(available))
    }
}

我使用Truenas Scale来存储我的模型并运行模型。它使用zfs作为文件系统,这意味着ARC会占用大量内存。我不知道Truenas具体做了什么,但它们让ARC大小表现得像BSD,自然地尽可能多地使用内存。如果有其他东西尝试使用更多内存,它会减少。因此,当我尝试运行一个可能导致OOM的模型时,Ollama会惊慌失措,但实际上我确实有足够的内存。在我看来,一个标志是最容易实现的,但也许它可以尝试变得聪明一些,从计算中移除zfs arc?

uxh89sit

uxh89sit1#

在查看 openzfs/zfs#10255 时,似乎在找到最优解决方案之前的一个解决方法是将 zfs_arc_sys_free 设置为系统内存中模型所需的内存量。

相关问题