AdamWClip: AdamW with adaptive gradient clipping
AdamWClip is an optimizer that extends AdamW with adaptive gradient clipping. It automatically adapts the gradient clipping thresholds to the gradient statistics of each parameter resulting in equivariant thresholds with respect to scaling the gradients. This makes finding suitable clipping thresholds much easier (usually, the default threshold of AdamWClip is good to go). Furthermore, by directly utilizing the internal state variables of Adam, AdamWClip doesn't require additional memory (and only a marginal computational overhead).
Useage
To use AdamWClip in your pytorch project, simply run the following:
%pip install AdamWClip
from AdamWClip import AdamWClip
...
optimizer = AdamWClip(model.parameters(),*args)
On top of the standard parameters from AdamW, AdamWClip offers the following additional parameters:
- clip_grad_adapt: adaptive gradient clipping threshold in terms of standard deviations of the clipped gradient distribution. If set to None, this optimizer behaves exactly like AdamW (default: 3)
- clip_grad_min: minimum value for the adaptive gradient clipping threshold (default: 1e-10)
- clip_grad_warm_up: (Optional) number of initial update steps without gradient clipping to obtain more reasonable gradient statistics at the beginning (default: 0)
In most instances, the default values should be fine.
If this optimizer becomes useful to you, please consider citing this repository :)
Metadata
Release files for AdamWClip 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| adamwclip-0.1.4.tar.gz | 3.2 kB | Without provenance | Details for adamwclip-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| adamwclip-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for adamwclip-0.1.4-py3-none-any.whl |
Total release size: 6.7 kB
Release files / adamwclip-0.1.4.tar.gz
| Download URL | adamwclip-0.1.4.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e63a00f814d616af08340ebda6d923f983e0bb0e9d5455f1d9ccd9384e7ace6
|
|
BLAKE2b-256 checksum How to use checksums |
56a31db8bfd0a80d2561f9eee10a9bf8d5a8fadfd456b9073baafda16300ab72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / adamwclip-0.1.4-py3-none-any.whl
| Download URL | adamwclip-0.1.4-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3241d13c21fce928d4154f604e07ba35513b8a096854cf66248eed2fe2ec6b9a
|
|
BLAKE2b-256 checksum How to use checksums |
ce0ed9f36521007fe92a213af586bddc1deed9013996572638b3dedee6ca8add
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Security for AdamWClip 0.1.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.