Skip to main content

Adam-atan2 for Pytorch

Project description

Adam-atan2 - Pytorch

Implementation of the proposed Adam-atan2 optimizer in Pytorch

A multi-million dollar paper out of google deepmind proposes a small change to Adam update rule (using atan2) to remove the epsilon altogether for numerical stability and scale invariance

It also contains some features for improving plasticity (continual learning field)

Install

$ pip install adam-atan2-pytorch

Usage

import torch
from torch import nn

# toy model

model = nn.Linear(10, 1)

# import AdamAtan2 and instantiate with parameters

from adam_atan2_pytorch import AdamAtan2

opt = AdamAtan2(model.parameters(), lr = 1e-4)

# forward and backwards

for _ in range(100):
  loss = model(torch.randn(10))
  loss.backward()

  # optimizer step

  opt.step()
  opt.zero_grad()

Citations

@inproceedings{Everett2024ScalingEA,
    title   = {Scaling Exponents Across Parameterizations and Optimizers},
    author  = {Katie Everett and Lechao Xiao and Mitchell Wortsman and Alex Alemi and Roman Novak and Peter J. Liu and Izzeddin Gur and Jascha Narain Sohl-Dickstein and Leslie Pack Kaelbling and Jaehoon Lee and Jeffrey Pennington},
    year    = {2024},
    url     = {https://api.semanticscholar.org/CorpusID:271051056}
}
@inproceedings{Kumar2023MaintainingPI,
    title   = {Maintaining Plasticity in Continual Learning via Regenerative Regularization},
    author  = {Saurabh Kumar and Henrik Marklund and Benjamin Van Roy},
    year    = {2023},
    url     = {https://api.semanticscholar.org/CorpusID:261076021}
}
@article{Lewandowski2024LearningCB,
    title   = {Learning Continually by Spectral Regularization},
    author  = {Alex Lewandowski and Saurabh Kumar and Dale Schuurmans and Andr'as Gyorgy and Marlos C. Machado},
    journal = {ArXiv},
    year    = {2024},
    volume  = {abs/2406.06811},
    url     = {https://api.semanticscholar.org/CorpusID:270380086}
}
@inproceedings{Taniguchi2024ADOPTMA,
    title   = {ADOPT: Modified Adam Can Converge with Any \$\beta\_2\$ with the Optimal Rate},
    author  = {Shohei Taniguchi and Keno Harada and Gouki Minegishi and Yuta Oshima and Seong Cheol Jeong and Go Nagahara and Tomoshi Iiyama and Masahiro Suzuki and Yusuke Iwasawa and Yutaka Matsuo},
    year    = {2024},
    url     = {https://api.semanticscholar.org/CorpusID:273822148}
}

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

adam_atan2_pytorch-0.1.10.tar.gz (419.6 kB view details)

Uploaded Source

Built Distribution

adam_atan2_pytorch-0.1.10-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file adam_atan2_pytorch-0.1.10.tar.gz.

File metadata

  • Download URL: adam_atan2_pytorch-0.1.10.tar.gz
  • Upload date:
  • Size: 419.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for adam_atan2_pytorch-0.1.10.tar.gz
Algorithm Hash digest
SHA256 6ee00b06ab4574567c1bc7945f4ad1edb92f382d1ccbeff47cb2c7bc86fc9433
MD5 c8e95143cf9c4251af1a93a2afd2ebec
BLAKE2b-256 bb0f9e1f193790ce22e08c86a6872c352476b4b6fb24afec8a66199e20e59130

See more details on using hashes here.

File details

Details for the file adam_atan2_pytorch-0.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for adam_atan2_pytorch-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 81d2bafa90a10f0a91af539c9086fabf4bf68deb5630942da900ed26f45ea330
MD5 6d636716587931e043ebff45439de58e
BLAKE2b-256 4ac470b36c1ff1c2bc4ceb6dd1c39dfcf1f0fa0055941704df44210ce9aa3fc5

See more details on using hashes here.

Supported by

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