Skip to content

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

ollamarunner: Provide mechanism for backends to report loading progress

Jesse Gross0ff28758b3a5
diff --git a/ml/backend.go b/ml/backend.go
index c63c73d46..66eb37f78 100644
--- a/ml/backend.go
+++ b/ml/backend.go
@@ -60,6 +60,10 @@ type CacheConfig struct {
// BackendParams controls how the backend loads and executes models
type BackendParams struct {
+ // Progress is a callback function that allows reporting percentage completion
+ // of model loading
+ Progress func(float32)
+
// NumThreads sets the number of threads to use if running on the CPU
NumThreads int
diff --git a/runner/ollamarunner/runner.go b/runner/ollamarunner/runner.go
index 443b34b05..90eb0de62 100644
--- a/runner/ollamarunner/runner.go
+++ b/runner/ollamarunner/runner.go
@@ -783,6 +783,9 @@ func Execute(args []string) error {
}
params := ml.BackendParams{
+ Progress: func(progress float32) {
+ server.progress = progress
+ },
NumThreads: *threads,
NumGPULayers: *numGPULayers,
MainGPU: *mainGPU,