Skip to main content

No project description provided

Project description

logo logo

Documentation | Install | Usage | Examples | Contributing

ci PyPI

A library to experiment with new optimization algorithms in MLX.

  • Diverse Exploration: includes proven and experimental optimizers like DiffGrad, QHAdam, and Muon (docs).
  • Easy Integration: fully compatible with MLX for straightforward experimentation and downstream adoption.
  • Benchmark Examples: enables quick testing on classic optimization and machine learning tasks.

The design of mlx-optmizers is largely inspired by pytorch-optmizer.

Install

The reccomended way to install mlx-optimizers is to install the latest stable release through PyPi:

pip install mlx-optimizers

To install mlx-optimizers from source, first clone the repository:

git clone https://github.com/stockeh/mlx-optimizers.git
cd mlx-optimizers

Then run

pip install -e .

Usage

There are a variety of optimizers to choose from (see docs). Each of these inherit the mx.optimizers class from MLX, so the core functionality remains the same. We can simply use the optimizer as follows:

import mlx_optimizers as optim

#... model, grads, etc.
optimizer = optim.DiffGrad(learning_rate=0.001)
optimizer.update(model, grads)

Examples

The examples folder offers a non-exhaustive set of demonstrative use cases for mlx-optimizers. This includes classic optimization benchmarks on the Rosenbrock function and training a simple neural net classifier on MNIST.

logo mnist logo mnist

Contributing

Interested in adding a new optimizer? Start with verifying it is not already implemented or in development, then open a new feature request! If you spot a bug, please open a bug report.

Developer? See our contributing guide.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlx_optimizers-0.4.0.tar.gz (34.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mlx_optimizers-0.4.0-py3-none-any.whl (37.8 kB view details)

Uploaded Python 3

File details

Details for the file mlx_optimizers-0.4.0.tar.gz.

File metadata

  • Download URL: mlx_optimizers-0.4.0.tar.gz
  • Upload date:
  • Size: 34.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for mlx_optimizers-0.4.0.tar.gz
Algorithm Hash digest
SHA256 53ff2645239f7d2525cc89cc93c21aa0db905bddc0e10b92ad50cba99e23eb7d
MD5 ea0e067462d907029302d82926af611b
BLAKE2b-256 a45a548b7ee3f5a82ea2ff7013368a8dd09d8551eb71b700ec72f85be810f454

See more details on using hashes here.

File details

Details for the file mlx_optimizers-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: mlx_optimizers-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 37.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for mlx_optimizers-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e456c4d997e0805e9f6c381d10171f8298561f4880bc0fd9bd7bfb36bf254ac6
MD5 55ad395f701fe20bff997299d25f86f1
BLAKE2b-256 8e85f86fcb2dfa2a7bf02886a6b63569b610ab5ce835afc758f494cfef441fbc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page