MLX is a specialized framework for machine learning, specifically designed for use with Apple's silicon chips, and is a product of Apple's machine learning research efforts. The primary aim of MLX is to offer a user-friendly yet efficient platform for both training and deploying various machine learning models. With a design that emphasizes simplicity, it encourages researchers to easily contribute and innovate within its structure. MLX takes inspiration from renowned frameworks such as NumPy, PyTorch, Jax, and ArrayFire, and is capable of supporting large language models like StableDiffusion, Whisper, and others on Apple silicon devices.
The following steps outline the installation process of MLX on a Mac Studio (Apple M1 Ultra), which requires Xcode and conda.
git clone https://github.com/ml-explore/mlx
cd mlx
mkdir -p build && cd build
conda create -n mlx python=3.10
conda activate mlx
conda install pybind11
and conda install pytorch torchvision torchaudio -c pytorch
env CMAKE_BUILD_PARALLEL_LEVEL="" pip install -e .
, cmake .. && make -j
, make test
, make install
For complete installation details, visit https://ml-explore.github.io/mlx/build/html/install.html.After installing MLX, you can explore its capabilities with various examples.
git clone https://github.com/ml-explore/mlx-examples.git
cd mlx-examples/mistral
pip install -r requirements.txt
curl -O https://files.mistral-7b-v0-1.mistral.ai/mistral-7B-v0.1.tar
tar -xf mistral-7B-v0.1.tar
python convert.py
python mistral.py --prompt "Your prompt here" --temp 0
cd ../whisper
python txt2image.py "Your image prompt"