Files
ollama/x/imagegen/cmd/engine
Daniel Hiltgen 12719b6e87 MLX - dynamic loading of mlx-c (#13735)
* MLX - dynamic loading of mlx-c

Create a wrapper layer to indirect the dependency on mlx-c so
the main ollama binary does not have a load-time dependency on mlx-c, mlx, and on linux, cuda.  Lazy load the library via dlopen
so we can adjust the path to ensure the dependencies are found
and fail gracefully if not present.

* review comments

* fix broken tests
2026-01-16 16:34:22 -08:00
..

MLX Engine

Experimental MLX backend for running models on Apple Silicon and CUDA.

Build

go build -tags mlx -o engine ./x/imagegen/cmd/engine

Text Generation

./engine -model /path/to/model -prompt "Hello" -max-tokens 100

Options:

  • -temperature - sampling temperature (default 0.7)
  • -top-p - nucleus sampling (default 0.9)
  • -top-k - top-k sampling (default 40)

Supports: Llama, Gemma3, GPT-OSS

Image Generation

./engine -zimage -model /path/to/z-image -prompt "a cat" -output cat.png

Options:

  • -width, -height - image dimensions (default 1024x1024)
  • -steps - denoising steps (default 9)
  • -seed - random seed (default 42)