Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

fix the cpu estimatedTotal memory + get the expiry time for loading models (#4461)

Patrick Devined1692fd3e0b4
diff --git a/llm/server.go b/llm/server.go
index 119699971..ccb1e4191 100644
--- a/llm/server.go
+++ b/llm/server.go
@@ -89,6 +89,7 @@ func NewLlamaServer(gpus gpu.GpuInfoList, model string, ggml *GGML, adapters, pr
cpuRunner = serverForCpu()
gpuCount = 0
+ _, _, estimatedTotal = EstimateGPULayers(gpus, ggml, projectors, opts)
} else {
if gpus[0].Library == "metal" {
memInfo, err := gpu.GetCPUMem()
diff --git a/server/routes.go b/server/routes.go
index 42b5c9102..e991e7740 100644
--- a/server/routes.go
+++ b/server/routes.go
@@ -1161,6 +1161,14 @@ func (s *Server) ProcessHandler(c *gin.Context) {
Details: modelDetails,
ExpiresAt: v.expiresAt,
}
+ // The scheduler waits to set expiresAt, so if a model is loading it's
+ // possible that it will be set to the unix epoch. For those cases, just
+ // calculate the time w/ the sessionDuration instead.
+ var epoch time.Time
+ if v.expiresAt == epoch {
+ mr.ExpiresAt = time.Now().Add(v.sessionDuration)
+ }
+
models = append(models, mr)
}