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.2.0.tar.gz (27.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.2.0-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mlx_optimizers-0.2.0.tar.gz
  • Upload date:
  • Size: 27.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.2.0.tar.gz
Algorithm Hash digest
SHA256 3362d238c306e0983db01c31397a9aaf0c80866a9d4e5aebca2befa90579a87c
MD5 ad8ae3b0d657f02109872735dab8d5cd
BLAKE2b-256 83e5ba864b59f32b5e966a3854bddfb9e750fd3db2ae3ed1d43d96e05be3577b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mlx_optimizers-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 28.6 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24ec20be535f76b5b60ff00d2916bea91a9f32c56d433729adf98c7fdece76b8
MD5 806dff8a65553bd974a180b012488da6
BLAKE2b-256 2a800c51eede67687194c0350c1b6f76e654d629f21da30337a5c20d3f91dca9

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