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.3.0.tar.gz (31.0 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.3.0-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mlx_optimizers-0.3.0.tar.gz
  • Upload date:
  • Size: 31.0 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.3.0.tar.gz
Algorithm Hash digest
SHA256 fb4e1478a97e7ed4e89a020c478f2a6e633e28df58131b09621cab9ac5165f0f
MD5 c892abb95a38b97c27faf8e77954a4a6
BLAKE2b-256 82ba30e72736eb90dab7d45ad4deb66735c0a5f847789235dd7088fea7decd2a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mlx_optimizers-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 32.3 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b99862045a5161af66b484153b1c8d471be17bdf0f722b159ad0db6471c76b6c
MD5 a14953f0032921c601bd8f5e17d5771b
BLAKE2b-256 4f6937487e8e6527f8bcc8c122e3291f8d214bbee7a5c54baa51365f97de542e

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