MLX: An array framework for Apple silicon
mlx
Go to file
Awni Hannun e6fecbb3e1
Some fixes in docs (#1141)
* fixes in docs

* nit
2024-05-20 11:51:47 -07:00
.circleci Choose the right MLX bf16 for extensions (#1135) 2024-05-17 15:09:28 -07:00
.github Adds issue template with common questions (#345) 2024-01-02 16:52:20 -08:00
benchmarks Add groups to Conv1d (#948) 2024-04-27 06:24:57 -07:00
cmake Shared events for synchronization + async eval (#998) 2024-04-17 06:16:02 -07:00
docs Some fixes in docs (#1141) 2024-05-20 11:51:47 -07:00
examples Fix extensions (#1126) 2024-05-16 15:36:25 -07:00
mlx Improve qvm speed (#1140) 2024-05-20 09:20:44 -07:00
python Some fixes in docs (#1141) 2024-05-20 11:51:47 -07:00
tests Implemented Cholesky on CPU (#1119) 2024-05-17 12:31:59 -07:00
.clang-format awni's commit files 2023-11-29 10:30:41 -08:00
.gitignore Safetensor support (#215) 2023-12-27 02:06:55 -08:00
.pre-commit-config.yaml feat: metal formatting and pre-commit bump (#1038) 2024-04-30 07:18:09 -07:00
ACKNOWLEDGMENTS.md feat: implement `clip_grad_norm` (#1043) 2024-05-03 09:07:02 -07:00
CMakeLists.txt patch bump (#1131) 2024-05-16 20:51:33 -07:00
CODE_OF_CONDUCT.md contribution and code of conduct (#1) 2023-11-29 12:54:28 -08:00
CONTRIBUTING.md Readme (#2) 2023-11-29 16:23:42 -08:00
LICENSE copyright + ack 2023-11-30 11:12:53 -08:00
MANIFEST.in CI change (#645) 2024-02-07 06:04:34 -08:00
README.md Update README.md (#1136) 2024-05-20 06:16:40 -07:00
mlx.pc.in awni's commit files 2023-11-29 10:30:41 -08:00
pyproject.toml fix gguf loading quants (#1014) 2024-04-19 12:24:07 -07:00
setup.py patch bump (#1131) 2024-05-16 20:51:33 -07:00

README.md

MLX

Quickstart | Installation | Documentation | Examples

CircleCI

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 and mlx.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:

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},
}