Skip to main content

adagradw - Decoupled Weight Decay for Adagrad

The Adagrad optimizer preconditions the gradient update by the accumulated sum of squares of gradients. Assuming a batch size of 1 and learning rate of 0, this accumulated sum of squares of gradients is a diagonal approximation to the Empirical Fisher information matrix. However, using weight decay, the original PyTorch implementation updates the gradient with the gradient of the regularization term before computing the squared gradient, in which case the earlier equivalence to the empirical Fisher information does not hold anymore. This implementation applies the same trick as the AdamW optimizer to decouple weight decay and learning rate in Adam, by directly applying the regularizer's gradient step rather than combining gradients, thus recovering the equivalence with approximate computation of the Empirical Fisher information even when using weight decay.

Usage

Install with pip install adagradw and then just use as drop-in replacement

- optim = torch.optim.Adagrad(model.parameters(), lr=1e-3)
+ optim = adagradw.AdagradW(model.parameters(), lr=1e-3)

  for x, y in train_dataloader:
      loss = loss_fn(model(x), y)
      
      optim.zero_grad()
      loss.backward()
      optim.step()

Metadata

Release files for adagradw 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adagradw 0.0.4
File Size Uploaded Provenance
adagradw-0.0.4.tar.gz 5.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for adagradw 0.0.4
File Interpreter ABI Platform
adagradw-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 kB

Release files / adagradw-0.0.4.tar.gz

Download URL adagradw-0.0.4.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f899140f60713e8d6ddf2a092668692e509b7c37cc1e08891903d20344339951
BLAKE2b-256 checksum
How to use checksums
0b2e46240967243c5781a0529dd89212f60542307a76b0fa6e1fbaec6fe0ab10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / adagradw-0.0.4-py3-none-any.whl

Download URL adagradw-0.0.4-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
899f1d29c32fbba04e5efb9100be2e4a4bd8c64b48169b7434dbc15f778fd3b6
BLAKE2b-256 checksum
How to use checksums
1d4fbd52d1a94e454455262223aef54bb0e79611846e9be59fe3b65a65977dcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Security for adagradw 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page