A framework for machine learning on Apple silicon.
Project description
MLX
Quickstart | Installation | Documentation | Examples
MLX is an array framework for machine learning on Apple silicon, brought to you by Apple machine learning research.
Some key features of MLX include:
-
Familiar APIs: MLX has a Python API that closely follows NumPy. MLX also has fully featured C++, C, and Swift APIs, which closely mirror the Python API. MLX has higher-level packages like
mlx.nn
andmlx.optimizers
with APIs that closely follow PyTorch to simplify building more complex models. -
Composable function transformations: MLX supports composable function transformations for automatic differentiation, automatic vectorization, and computation graph optimization.
-
Lazy computation: Computations in MLX are lazy. Arrays are only materialized when needed.
-
Dynamic graph construction: Computation graphs in MLX are constructed dynamically. Changing the shapes of function arguments does not trigger slow compilations, and debugging is simple and intuitive.
-
Multi-device: Operations can run on any of the supported devices (currently the CPU and the GPU).
-
Unified memory: A notable difference from MLX and other frameworks is the unified memory model. Arrays in MLX live in shared memory. Operations on MLX arrays can be performed on any of the supported device types without transferring data.
MLX is designed by machine learning researchers for machine learning researchers. The framework is intended to be user-friendly, but still efficient to train and deploy models. The design of the framework itself is also conceptually simple. We intend to make it easy for researchers to extend and improve MLX with the goal of quickly exploring new ideas.
The design of MLX is inspired by frameworks like NumPy, PyTorch, Jax, and ArrayFire.
Examples
The MLX examples repo has a variety of examples, including:
- Transformer language model training.
- Large-scale text generation with LLaMA and finetuning with LoRA.
- Generating images with Stable Diffusion.
- Speech recognition with OpenAI's Whisper.
Quickstart
See the quick start guide in the documentation.
Installation
MLX is available on PyPI. To install the Python API, run:
With pip
:
pip install mlx
With conda
:
conda install -c conda-forge mlx
Checkout the documentation for more information on building the C++ and Python APIs from source.
Contributing
Check out the contribution guidelines for more information on contributing to MLX. See the docs for more information on building from source, and running tests.
We are grateful for all of our contributors. If you contribute to MLX and wish to be acknowledged, please add your name to the list in your pull request.
Citing MLX
The MLX software suite was initially developed with equal contribution by Awni Hannun, Jagrit Digani, Angelos Katharopoulos, and Ronan Collobert. If you find MLX useful in your research and wish to cite it, please use the following BibTex entry:
@software{mlx2023,
author = {Awni Hannun and Jagrit Digani and Angelos Katharopoulos and Ronan Collobert},
title = {{MLX}: Efficient and flexible machine learning on Apple silicon},
url = {https://github.com/ml-explore},
version = {0.0},
year = {2023},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file mlx-0.21.0-cp313-cp313-macosx_14_0_arm64.whl
.
File metadata
- Download URL: mlx-0.21.0-cp313-cp313-macosx_14_0_arm64.whl
- Upload date:
- Size: 27.2 MB
- Tags: CPython 3.13, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3155918a74c5cdb87839e999b069b887043166b1370946a4ef4c633b555861ae |
|
MD5 | 72d67a19c3506de4185f66ac8647c961 |
|
BLAKE2b-256 | 41e64b6341151ea4593423337255bbf50dcad0ba3600c050013a1502a21b7427 |
File details
Details for the file mlx-0.21.0-cp313-cp313-macosx_13_0_arm64.whl
.
File metadata
- Download URL: mlx-0.21.0-cp313-cp313-macosx_13_0_arm64.whl
- Upload date:
- Size: 27.5 MB
- Tags: CPython 3.13, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18609008b0d51b22b400df967a702163c7501fecc8cc4b861d95ca147177cd1f |
|
MD5 | ed554dafd7e4e903f0eeb099b22ec88d |
|
BLAKE2b-256 | e355cfcde5014d0e8c747c431a3384f3814857af3efbecd9f543eecf7b273fb4 |
File details
Details for the file mlx-0.21.0-cp312-cp312-macosx_14_0_arm64.whl
.
File metadata
- Download URL: mlx-0.21.0-cp312-cp312-macosx_14_0_arm64.whl
- Upload date:
- Size: 27.2 MB
- Tags: CPython 3.12, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75f80f3dd515b75dbc24609e1000e965b956a18acb1f461da615f2fcdffd6ea0 |
|
MD5 | 0ccdfa760623537b5be84c9dcd9a7c82 |
|
BLAKE2b-256 | 5b37e78916a1207282697f53588c82f5fb08d5e9403d28b0e606acdb450b068b |
File details
Details for the file mlx-0.21.0-cp312-cp312-macosx_13_0_arm64.whl
.
File metadata
- Download URL: mlx-0.21.0-cp312-cp312-macosx_13_0_arm64.whl
- Upload date:
- Size: 27.5 MB
- Tags: CPython 3.12, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43fadf0c5975d9dacdaa54e34170705dd70706b086b1cb3aec56725373e703f7 |
|
MD5 | 8c737aab53ff531806daf965c96c7edf |
|
BLAKE2b-256 | a6340dc365b671b2dc3bc72b230c29b2a3e935e6904641c5799446ac6e7b3dc1 |
File details
Details for the file mlx-0.21.0-cp311-cp311-macosx_14_0_arm64.whl
.
File metadata
- Download URL: mlx-0.21.0-cp311-cp311-macosx_14_0_arm64.whl
- Upload date:
- Size: 27.2 MB
- Tags: CPython 3.11, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ab901a29c7af9942b9139c6b0780ca5fdbb46210a3e1ef4c2ba3c33d717ab68 |
|
MD5 | 165f1ef57d6e12870696f8e9bfec6a60 |
|
BLAKE2b-256 | a3f8aa5ea4004bc5e88633858f94778ae113ee2be000ab86b32eccfe995c3b33 |
File details
Details for the file mlx-0.21.0-cp311-cp311-macosx_13_0_arm64.whl
.
File metadata
- Download URL: mlx-0.21.0-cp311-cp311-macosx_13_0_arm64.whl
- Upload date:
- Size: 27.5 MB
- Tags: CPython 3.11, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 853848109ed5e6894ac72c2609cebe108f457597703154dcc0ac26945c89bcde |
|
MD5 | c5c3318ad29f23e98b718c4f8e348ac4 |
|
BLAKE2b-256 | 3311023f3460b8559441bf84631414577504d1460421793e916d792630ce4511 |
File details
Details for the file mlx-0.21.0-cp310-cp310-macosx_14_0_arm64.whl
.
File metadata
- Download URL: mlx-0.21.0-cp310-cp310-macosx_14_0_arm64.whl
- Upload date:
- Size: 27.2 MB
- Tags: CPython 3.10, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7b6a7d9411cc9a9cfdffeb69a8367bb7ec01bd56c1a528e35895dea83d1ce89 |
|
MD5 | ed2c94bf04538d0b4ca59712e0decfd5 |
|
BLAKE2b-256 | 25881807e0cbefbad8050f9efd2fea91e31000e68a8c501146b6eaa3b57c111f |
File details
Details for the file mlx-0.21.0-cp310-cp310-macosx_13_0_arm64.whl
.
File metadata
- Download URL: mlx-0.21.0-cp310-cp310-macosx_13_0_arm64.whl
- Upload date:
- Size: 27.5 MB
- Tags: CPython 3.10, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7467bda3a107e278f87451b2b06cc58285c3e56124f52721ae2d7ebdadd6af59 |
|
MD5 | 2df6db65f5e08e40a2476296c8b3dd9b |
|
BLAKE2b-256 | b0670f0f2b6dcac73c109927ce95f65b451bed414cdde420543c63b0b4a8a97d |
File details
Details for the file mlx-0.21.0-cp39-cp39-macosx_14_0_arm64.whl
.
File metadata
- Download URL: mlx-0.21.0-cp39-cp39-macosx_14_0_arm64.whl
- Upload date:
- Size: 27.2 MB
- Tags: CPython 3.9, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86c8d7c89887826f074ab86a429f7c5508258eeda9fab4d02ca23c3e43d7e494 |
|
MD5 | f1540a2797c5b06d7a1cb304a153243d |
|
BLAKE2b-256 | 5fa27868ee98d0a09ce58f7731c654192c912cf6b6ab126d72b722d12db0671a |
File details
Details for the file mlx-0.21.0-cp39-cp39-macosx_13_0_arm64.whl
.
File metadata
- Download URL: mlx-0.21.0-cp39-cp39-macosx_13_0_arm64.whl
- Upload date:
- Size: 27.5 MB
- Tags: CPython 3.9, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 310eabbb526f88567d2d931db8b9e830926046e3ad0b062f43f99131576f90c2 |
|
MD5 | 33e31da2100188a9bb7c6ac65c39c8f2 |
|
BLAKE2b-256 | 796b0a5e29b41b088d736384c8bdfeee707264726b09d4e489f1bc806655f274 |