Skip to content

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

mlx: avoid pulling MLX models when MLX is missing (#17710)

Daniel Hiltgen88313499e0dc
diff --git a/server/images.go b/server/images.go
index 7e265ea11..23fb932b6 100644
--- a/server/images.go
+++ b/server/images.go
@@ -31,6 +31,7 @@ import (
"github.com/ollama/ollama/thinking"
"github.com/ollama/ollama/types/model"
"github.com/ollama/ollama/version"
+ "github.com/ollama/ollama/x/mlxrunner/mlx"
"github.com/ollama/ollama/x/transfer"
)
@@ -1016,6 +1017,12 @@ func PullModel(ctx context.Context, name string, regOpts *registryOptions, fn fu
if err != nil {
return fmt.Errorf("pull model manifest: %s", err)
}
+ if hasTensorLayers(mf.Layers) {
+ if err := mlx.CheckInit(); err != nil {
+ slog.Debug("MLX is unavailable for safetensors model pull", "error", err)
+ return errors.New("this model requires MLX support, but the MLX runtime is not available")
+ }
+ }
var layers []manifest.Layer
layers = append(layers, mf.Layers...)