Scalable Adam Optimizer
Project description
SAdam
SAdam (Scalable Adam) is an experimental optimizer that we
mathematically replace each parameters (p) in the model with
p = a * exp(b)
which means the convergence of Adam still holds since
we're implicitly optimizing the a and b
Install
pip install sadam
Example
import torch
from torch.optim import Adam
from sadam import SAdam
optimizer_class = SAdam # Adam
inp = torch.tensor([[1., 0.], [0., 1.]])
tgt = torch.tensor([7000., 3000.])
model = torch.nn.Linear(2, 1, bias=False)
opt = optimizer_class(model.parameters(), lr=1e-3)
model.train()
for i in range(10000):
pred = model(inp).view(-1)
loss = torch.nn.functional.mse_loss(pred, tgt)
opt.zero_grad()
loss.backward()
opt.step()
if i % 100 == 0:
print(i, pred, loss)
Contact Us
If you have any suggestions or questions about this work, please feel free to leave an issue or send an email to this mailbox.
License
2023 Jijia Wu
This repository is licensed under the MIT license. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sadam-0.0.1.tar.gz.
File metadata
- Download URL: sadam-0.0.1.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
241431e4c5e8542fd23c6b525689d0f0164bc76a5d2f41c25b82d9f1d793f9ad
|
|
| MD5 |
9658656a1a9a760fa69f2bfa4e1519bc
|
|
| BLAKE2b-256 |
8677e7236f98a2d6f08b7f062b7ff2c9ee382aef036dfea2773d7dc25e382442
|
File details
Details for the file sadam-0.0.1-py3.10.egg.
File metadata
- Download URL: sadam-0.0.1-py3.10.egg
- Upload date:
- Size: 9.8 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8c8d2991447e7b62c4e3e696ec55bbd0a2c28bc88649496f264f74026281682
|
|
| MD5 |
f104bd856093c76d0beb1c17c418b31d
|
|
| BLAKE2b-256 |
93be9776eebf0d85f74b24f35969c2fcd0fb0bb686e8853dfa0b6eed6b1c098c
|
File details
Details for the file sadam-0.0.1-py3-none-any.whl.
File metadata
- Download URL: sadam-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4e1db1b5277e07ce019278998fda7a02d5ae186282268594dcb7f0928873a93
|
|
| MD5 |
910a4befc661c64e9422be7b0c5af663
|
|
| BLAKE2b-256 |
5c828dd6f30f53b09d2a3201bb1dc34aab769d7d9d985292d918f06d0517c1e9
|