About Anaconda Help Download Anaconda

flvincen / packages / mechanic-pytorch 0.0.1

black box tuning of optimizers

Installers

  • linux-64 v0.0.1

conda install

To install this package run one of the following:
conda install flvincen::mechanic-pytorch

Description

Based on the paper: https://arxiv.org/abs/2306.00144 Be aware that all experiments reported in the paper were run using the JAX version of mechanic, which is available in optax via optax.contrib.mechanize. Mechanic aims to remove the need for tuning a learning rate scalar (i.e. the maximum learning rate in a schedule). You can use it with any pytorch optimizer and schedule. Simply replace:

optimizer = torch.optim.SGD(model.parameters(), lr=0.01)

with:

from mechanic_pytorch import mechanize
optimizer = mechanize(torch.optim.SGD)(model.parameters(), lr=1.0)

You can set the lr to anything here. However, excessively small values may cause numerical precision issues. Mechanic's scale factor will be multiplied by the base optimizer's learning rate. That's it! The new optimizer should no longer require tuning the learning rate scale! That is, the optimizer should now be very robust to heavily mis-specified values of lr.


© 2025 Anaconda, Inc. All Rights Reserved. (v4.2.2) Legal | Privacy Policy