A framework for machine learning on Apple silicon.
Project description
MLX
Quickstart | Installation | Documentation | Examples
MLX is an array framework for machine learning research 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
Hashes for mlx-0.16.3-cp312-cp312-macosx_14_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2833ab008878acf95a368ca18d44a2130b501174e720925e7bf96a93fecb9c59 |
|
MD5 | 51a1057aa3d438b64eace5cf389fd36b |
|
BLAKE2b-256 | f57ac1640b5df29a1acbbae719064a1c265ef522a3788d098c33ae7cab69631d |
Hashes for mlx-0.16.3-cp312-cp312-macosx_13_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ed01b7af129649756b65bb3057978ce148db18298311b3f935d14bf4c9bcd05 |
|
MD5 | 245371a16e72fa07e578048e56349026 |
|
BLAKE2b-256 | 655acbc5f2859c28a8a98aad4881bf7a3dc6a61a7b717ec282fe2136add54833 |
Hashes for mlx-0.16.3-cp311-cp311-macosx_14_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30784ef75eb0b1d77cde33f5a8017cb1f2547cb7cac5065796c4a9a7c6f1a3a7 |
|
MD5 | 28618213bb6973b50e3e5fcee000b0a4 |
|
BLAKE2b-256 | ec6391a8bf8a8c6ed72b8c20e75d481873553935204cba433d479981a1b6acaa |
Hashes for mlx-0.16.3-cp311-cp311-macosx_13_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9014411a6375ebf53ee75f19beb8b0eea43244d98fa2ba027801aec443346d3 |
|
MD5 | c1e594a6e935eda02aa4aa337b61b522 |
|
BLAKE2b-256 | 17212f4b8aab9cbc4284aa1024bd2c65e82f040aa1debca71a234b7c492859ce |
Hashes for mlx-0.16.3-cp310-cp310-macosx_14_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11b16bd69d2e0638b017c3fb36d130d23284f4ce97fe33af7c549f8bb35ad6fc |
|
MD5 | 0c348029a8eb3ea2d48e23cb3255eb49 |
|
BLAKE2b-256 | f42d769a7e9bb2888e94f70074130e4f512d2faf88f4f4918dd68f951b7c1887 |
Hashes for mlx-0.16.3-cp310-cp310-macosx_13_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9a7e6c5087c8467991190fd3857a17e510ddf729a7c24b7138cd025bce49133 |
|
MD5 | 5dfb10af2977f2628a2e92707f9381a4 |
|
BLAKE2b-256 | 90ffb65faae0736dfa91beab8b330c409c4cb85c24d5ff5daa8f0ad1ef3170f1 |
Hashes for mlx-0.16.3-cp39-cp39-macosx_14_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5271e018d4055faeff3edb2f200d8d58ec45978186817c72e0f4caa60a7a11fe |
|
MD5 | b73269107c6d9dc37548dea367131610 |
|
BLAKE2b-256 | 739b26cd4aeab9ffe576bc20ddd394800a1fdc21313dfefa930c82f87a3df039 |
Hashes for mlx-0.16.3-cp39-cp39-macosx_13_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fa37054659643a11b47cced1e693b601c71f98a0012849165d94893680d19da |
|
MD5 | cb5ebab3fd29d3229256bdd6a68663b7 |
|
BLAKE2b-256 | f17c7f23f5e9fef6e3f01803358fdfc1150e07954ab1703c3836dfdb2fa0b2db |
Hashes for mlx-0.16.3-cp38-cp38-macosx_14_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f633d33d4e9c7fe283425ba371334347b42c1bd08ed583baf26aaa90a24d46a |
|
MD5 | 3f2b95edc0d9590d8615eb62d8b53f29 |
|
BLAKE2b-256 | a0d8c67bb624fc2f72c2a4df0286af11daa1c6a1e81b0bfa575f0a5ec809dea4 |
Hashes for mlx-0.16.3-cp38-cp38-macosx_13_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a10fdb260df96ffd39dc46b614767b70bac4558c35117ddf5e9f993dc2b8444 |
|
MD5 | 083967a304308abd35221d5142223d17 |
|
BLAKE2b-256 | 5d7cb6fba6e372f2d6adfb79f201673ec0b03d1c25f4fe6019050037e570c25c |