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

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}
}

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.0.5.tar.gz (417.9 kB view details)

Uploaded Source

Built Distribution

adam_atan2_pytorch-0.0.5-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for adam_atan2_pytorch-0.0.5.tar.gz
Algorithm Hash digest
SHA256 6755e02d50d5c2579792dbc2d2abc50d13b61d37f00e6b1b83ef27aec5e59fab
MD5 ba65fa5333fe21c9ff631502cd0c8040
BLAKE2b-256 08ea0555113e26f5c491569293a85bd0f8b3eb5e184934d730479ef4c59ee306

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adam_atan2_pytorch-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4a114813a5ece37926e36cb1ad18cb067d2c0189d259dbec828ae7474b672b75
MD5 43b825fe3cde09d416511705814cf538
BLAKE2b-256 032cb5a85ad599d6033709bb6057380f081622af1bd17b50d2d352c9155613f9

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