mirror of
https://github.com/ollama/ollama.git
synced 2026-09-21 13:38:14 -05:00
mlx: avoid pulling MLX models when MLX is missing (#17710)
As we look to bring Linux and Windows MLX support online, instead of blocking downloads at the registry to avoid users wasting time downloading a model they can't run, shift the logic to the local side which knows if MLX is present or not.
This commit is contained in:
@@ -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...)
|
||||
|
||||
Reference in New Issue
Block a user