zengrad-pytorch 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zengrad_pytorch-1.0.0/PKG-INFO +64 -0
- zengrad_pytorch-1.0.0/README.md +46 -0
- zengrad_pytorch-1.0.0/setup.cfg +4 -0
- zengrad_pytorch-1.0.0/setup.py +27 -0
- zengrad_pytorch-1.0.0/zengrad-pytorch/__init__.py +1 -0
- zengrad_pytorch-1.0.0/zengrad-pytorch/zengrad-pytorch.py +48 -0
- zengrad_pytorch-1.0.0/zengrad_pytorch.egg-info/PKG-INFO +64 -0
- zengrad_pytorch-1.0.0/zengrad_pytorch.egg-info/SOURCES.txt +9 -0
- zengrad_pytorch-1.0.0/zengrad_pytorch.egg-info/dependency_links.txt +1 -0
- zengrad_pytorch-1.0.0/zengrad_pytorch.egg-info/requires.txt +1 -0
- zengrad_pytorch-1.0.0/zengrad_pytorch.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: zengrad-pytorch
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: ZenGrad: A gradient descent method focused on stability, smooth updates, and efficient, adaptive learning.
|
|
5
|
+
Home-page: https://github.com/Poorni-Murumuri/zengrad-pytorch
|
|
6
|
+
Author: Rishi Chaitanya Sri Prasad Nalluri
|
|
7
|
+
Author-email: rishichaitanya888@gmail.com
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Requires-Python: >=3.6
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: torch>=1.6.0
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# ZenGrad: Gradient Descent Optimizer
|
|
21
|
+
|
|
22
|
+
ZenGrad is a sophisticated gradient descent optimizer designed to provide a stable and controlled optimization process. By prioritizing smooth, gradual transitions and maintaining stability throughout training, ZenGrad minimizes the risk of erratic updates that can hinder model convergence. It is fully compatible with TensorFlow and offers an adaptive approach to model training, ensuring efficient and effective optimization.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
To install ZenGrad, run the following command:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install zengrad-pytorch
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Example Usage
|
|
33
|
+
|
|
34
|
+
You can use ZenGrad in your TensorFlow models as shown below:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
import torch
|
|
38
|
+
from zengrad-pytorch import ZenGrad # Custom optimizer
|
|
39
|
+
|
|
40
|
+
# Define the model
|
|
41
|
+
|
|
42
|
+
# Instantiate the model
|
|
43
|
+
model = SimpleModel()
|
|
44
|
+
|
|
45
|
+
# Define loss function
|
|
46
|
+
criterion = nn.CrossEntropyLoss()
|
|
47
|
+
|
|
48
|
+
# Instantiate optimizer
|
|
49
|
+
optimizer = ZenGrad(model.parameters(), lr=0.01)
|
|
50
|
+
|
|
51
|
+
# Model summary (optional)
|
|
52
|
+
print(model)
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Feedback & Contributions
|
|
57
|
+
|
|
58
|
+
If you have feedback or would like to contribute, please feel free to open an issue or contribute on GitHub.
|
|
59
|
+
|
|
60
|
+
Contact: Email: poorni.m0405@gmail.com, rishichaitanya888@gmail.com
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
ZenGrad (pytorch) is released under the [Apache License 2.0](https://github.com/Poorni-Murumuri/zengrad-pytorch/blob/main/LICENSE).
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
# ZenGrad: Gradient Descent Optimizer
|
|
3
|
+
|
|
4
|
+
ZenGrad is a sophisticated gradient descent optimizer designed to provide a stable and controlled optimization process. By prioritizing smooth, gradual transitions and maintaining stability throughout training, ZenGrad minimizes the risk of erratic updates that can hinder model convergence. It is fully compatible with TensorFlow and offers an adaptive approach to model training, ensuring efficient and effective optimization.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
To install ZenGrad, run the following command:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install zengrad-pytorch
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Example Usage
|
|
15
|
+
|
|
16
|
+
You can use ZenGrad in your TensorFlow models as shown below:
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
import torch
|
|
20
|
+
from zengrad-pytorch import ZenGrad # Custom optimizer
|
|
21
|
+
|
|
22
|
+
# Define the model
|
|
23
|
+
|
|
24
|
+
# Instantiate the model
|
|
25
|
+
model = SimpleModel()
|
|
26
|
+
|
|
27
|
+
# Define loss function
|
|
28
|
+
criterion = nn.CrossEntropyLoss()
|
|
29
|
+
|
|
30
|
+
# Instantiate optimizer
|
|
31
|
+
optimizer = ZenGrad(model.parameters(), lr=0.01)
|
|
32
|
+
|
|
33
|
+
# Model summary (optional)
|
|
34
|
+
print(model)
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Feedback & Contributions
|
|
39
|
+
|
|
40
|
+
If you have feedback or would like to contribute, please feel free to open an issue or contribute on GitHub.
|
|
41
|
+
|
|
42
|
+
Contact: Email: poorni.m0405@gmail.com, rishichaitanya888@gmail.com
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
ZenGrad (pytorch) is released under the [Apache License 2.0](https://github.com/Poorni-Murumuri/zengrad-pytorch/blob/main/LICENSE).
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
from setuptools import setup, find_packages
|
|
3
|
+
|
|
4
|
+
setup(
|
|
5
|
+
name='zengrad-pytorch',
|
|
6
|
+
version='1.0.0',
|
|
7
|
+
description='ZenGrad: A gradient descent method focused on stability, smooth updates, and efficient, adaptive learning.',
|
|
8
|
+
long_description=open('README.md', encoding='utf-8').read(),
|
|
9
|
+
long_description_content_type='text/markdown',
|
|
10
|
+
author= 'Rishi Chaitanya Sri Prasad Nalluri',
|
|
11
|
+
author_email='rishichaitanya888@gmail.com',
|
|
12
|
+
packages=find_packages(),
|
|
13
|
+
url='https://github.com/Poorni-Murumuri/zengrad-pytorch',
|
|
14
|
+
license="Apache-2.0",
|
|
15
|
+
install_requires=[
|
|
16
|
+
"torch>=1.6.0"
|
|
17
|
+
],
|
|
18
|
+
classifiers=[
|
|
19
|
+
'Programming Language :: Python :: 3',
|
|
20
|
+
"License :: OSI Approved :: Apache Software License",
|
|
21
|
+
'Operating System :: OS Independent',
|
|
22
|
+
'Intended Audience :: Developers',
|
|
23
|
+
'Intended Audience :: Science/Research',
|
|
24
|
+
'Topic :: Scientific/Engineering :: Artificial Intelligence',
|
|
25
|
+
],
|
|
26
|
+
python_requires='>=3.6',
|
|
27
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .zengrad-pytorch import ZenGrad
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import torch
|
|
2
|
+
from torch.optim import Optimizer
|
|
3
|
+
import math
|
|
4
|
+
|
|
5
|
+
class ZenGrad(Optimizer):
|
|
6
|
+
def __init__(self, params, lr=0.01, initial_accumulator_value=0.1):
|
|
7
|
+
if lr <= 0.0:
|
|
8
|
+
raise ValueError(f"Invalid learning rate: {lr}")
|
|
9
|
+
if initial_accumulator_value < 0.0:
|
|
10
|
+
raise ValueError(f"Invalid accumulator value: {initial_accumulator_value}")
|
|
11
|
+
|
|
12
|
+
defaults = dict(lr=lr, initial_accumulator_value=initial_accumulator_value)
|
|
13
|
+
super(ZenGrad, self).__init__(params, defaults)
|
|
14
|
+
|
|
15
|
+
def step(self, closure=None):
|
|
16
|
+
"""Performs a single optimization step."""
|
|
17
|
+
loss = None
|
|
18
|
+
if closure is not None:
|
|
19
|
+
loss = closure()
|
|
20
|
+
|
|
21
|
+
for group in self.param_groups:
|
|
22
|
+
lr = group['lr']
|
|
23
|
+
acc_init = group['initial_accumulator_value']
|
|
24
|
+
|
|
25
|
+
for p in group['params']:
|
|
26
|
+
if p.grad is None:
|
|
27
|
+
continue
|
|
28
|
+
|
|
29
|
+
grad = p.grad.data
|
|
30
|
+
if grad.is_sparse:
|
|
31
|
+
raise RuntimeError("ZenGrad does not support sparse gradients")
|
|
32
|
+
|
|
33
|
+
state = self.state[p]
|
|
34
|
+
|
|
35
|
+
# State initialization
|
|
36
|
+
if 'accumulator' not in state:
|
|
37
|
+
state['accumulator'] = torch.full_like(p.data, acc_init)
|
|
38
|
+
|
|
39
|
+
accumulator = state['accumulator']
|
|
40
|
+
accumulator.add_(grad.pow(2)) # A_t = A_{t-1} + g_t^2
|
|
41
|
+
|
|
42
|
+
# Compute effective learning rate
|
|
43
|
+
effective_lr = lr / (torch.log(accumulator + 1) + 1)
|
|
44
|
+
|
|
45
|
+
# Update parameters
|
|
46
|
+
p.data.addcmul_(grad, -effective_lr) # θ = θ - η_t * g_t
|
|
47
|
+
|
|
48
|
+
return loss
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: zengrad-pytorch
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: ZenGrad: A gradient descent method focused on stability, smooth updates, and efficient, adaptive learning.
|
|
5
|
+
Home-page: https://github.com/Poorni-Murumuri/zengrad-pytorch
|
|
6
|
+
Author: Rishi Chaitanya Sri Prasad Nalluri
|
|
7
|
+
Author-email: rishichaitanya888@gmail.com
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Requires-Python: >=3.6
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: torch>=1.6.0
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# ZenGrad: Gradient Descent Optimizer
|
|
21
|
+
|
|
22
|
+
ZenGrad is a sophisticated gradient descent optimizer designed to provide a stable and controlled optimization process. By prioritizing smooth, gradual transitions and maintaining stability throughout training, ZenGrad minimizes the risk of erratic updates that can hinder model convergence. It is fully compatible with TensorFlow and offers an adaptive approach to model training, ensuring efficient and effective optimization.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
To install ZenGrad, run the following command:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install zengrad-pytorch
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Example Usage
|
|
33
|
+
|
|
34
|
+
You can use ZenGrad in your TensorFlow models as shown below:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
import torch
|
|
38
|
+
from zengrad-pytorch import ZenGrad # Custom optimizer
|
|
39
|
+
|
|
40
|
+
# Define the model
|
|
41
|
+
|
|
42
|
+
# Instantiate the model
|
|
43
|
+
model = SimpleModel()
|
|
44
|
+
|
|
45
|
+
# Define loss function
|
|
46
|
+
criterion = nn.CrossEntropyLoss()
|
|
47
|
+
|
|
48
|
+
# Instantiate optimizer
|
|
49
|
+
optimizer = ZenGrad(model.parameters(), lr=0.01)
|
|
50
|
+
|
|
51
|
+
# Model summary (optional)
|
|
52
|
+
print(model)
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Feedback & Contributions
|
|
57
|
+
|
|
58
|
+
If you have feedback or would like to contribute, please feel free to open an issue or contribute on GitHub.
|
|
59
|
+
|
|
60
|
+
Contact: Email: poorni.m0405@gmail.com, rishichaitanya888@gmail.com
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
ZenGrad (pytorch) is released under the [Apache License 2.0](https://github.com/Poorni-Murumuri/zengrad-pytorch/blob/main/LICENSE).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
setup.py
|
|
3
|
+
zengrad-pytorch/__init__.py
|
|
4
|
+
zengrad-pytorch/zengrad-pytorch.py
|
|
5
|
+
zengrad_pytorch.egg-info/PKG-INFO
|
|
6
|
+
zengrad_pytorch.egg-info/SOURCES.txt
|
|
7
|
+
zengrad_pytorch.egg-info/dependency_links.txt
|
|
8
|
+
zengrad_pytorch.egg-info/requires.txt
|
|
9
|
+
zengrad_pytorch.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
torch>=1.6.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
zengrad-pytorch
|