Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ mlx Public
forked from ml-explore/mlx

MLX is an array framework for machine learning specifically designed to leverage the performance of Apple silicon. It features a unified memory model, lazy computation, and familiar APIs similar to NumPy and PyTorch to streamline research and model deployment.

License

Notifications You must be signed in to change notification settings

dougdotcon/mlx

 
 

Repository files navigation

MLX Array Framework

CircleCI

MLX Array Framework is a high-performance array library for machine learning on Apple silicon. Designed by Apple machine learning researchers, it provides a unified memory model that allows operations to run seamlessly across CPU and GPU without data copying.

Key Features

  • Familiar APIs: Features a Python API closely following NumPy, alongside fully featured C++, C, and Swift APIs. Includes mlx.nn and mlx.optimizers packages inspired by PyTorch.
  • Composable Function Transformations: Supports automatic differentiation, vectorization, and computation graph optimization.
  • Lazy Computation: Arrays are only materialized when strictly necessary, optimizing memory usage.
  • Dynamic Graph Construction: No slow compilations when changing input shapes; debugging is intuitive.
  • Unified Memory Model: Arrays live in shared memory, eliminating the need for data transfers between devices.

Quickstart

To get started, install the package via pip:

bash pip install mlx

Basic array operations:

python import mlx.core as mx

a = mx.array([1, 2, 3]) b = mx.array([4, 5, 6])

Operations are lazy, result is not computed yet

result = a + b

Computation happens when explicitly requested

print(mx.eval(result))

Installation

MLX requires macOS 13.3+ and an Apple Silicon machine (M1/M2/M3).

For detailed installation instructions, including building from source, please visit the official documentation.

Examples

The MLX examples repository contains a variety of demonstrations:

Documentation

Full documentation is available at https://ml-explore.github.io/mlx/.

Contributing

MLX is an open-source project intended to be useful for machine learning researchers. We welcome contributions that align with the project's goal of simplicity and efficiency.

License

This project is licensed under the BSD 3-Clause License.

About

MLX is an array framework for machine learning specifically designed to leverage the performance of Apple silicon. It features a unified memory model, lazy computation, and familiar APIs similar to NumPy and PyTorch to streamline research and model deployment.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 69.8%
  • Python 24.6%
  • Metal 4.2%
  • CMake 0.8%
  • Cuda 0.4%
  • C 0.2%