torchzero 0.3.10__py3-none-any.whl → 0.3.13__py3-none-any.whl
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.
- tests/test_identical.py +2 -3
- tests/test_opts.py +140 -100
- tests/test_tensorlist.py +8 -7
- tests/test_vars.py +1 -0
- torchzero/__init__.py +1 -1
- torchzero/core/__init__.py +2 -2
- torchzero/core/module.py +335 -50
- torchzero/core/reformulation.py +65 -0
- torchzero/core/transform.py +197 -70
- torchzero/modules/__init__.py +13 -4
- torchzero/modules/adaptive/__init__.py +30 -0
- torchzero/modules/adaptive/adagrad.py +356 -0
- torchzero/modules/adaptive/adahessian.py +224 -0
- torchzero/modules/{optimizers → adaptive}/adam.py +6 -8
- torchzero/modules/adaptive/adan.py +96 -0
- torchzero/modules/adaptive/adaptive_heavyball.py +54 -0
- torchzero/modules/adaptive/aegd.py +54 -0
- torchzero/modules/adaptive/esgd.py +171 -0
- torchzero/modules/{optimizers → adaptive}/lion.py +1 -1
- torchzero/modules/{experimental/spectral.py → adaptive/lmadagrad.py} +94 -71
- torchzero/modules/adaptive/mars.py +79 -0
- torchzero/modules/adaptive/matrix_momentum.py +146 -0
- torchzero/modules/adaptive/msam.py +188 -0
- torchzero/modules/{optimizers → adaptive}/muon.py +29 -5
- torchzero/modules/adaptive/natural_gradient.py +175 -0
- torchzero/modules/{optimizers → adaptive}/orthograd.py +1 -1
- torchzero/modules/{optimizers → adaptive}/rmsprop.py +7 -4
- torchzero/modules/{optimizers → adaptive}/rprop.py +42 -10
- torchzero/modules/adaptive/sam.py +163 -0
- torchzero/modules/{optimizers → adaptive}/shampoo.py +47 -9
- torchzero/modules/{optimizers → adaptive}/soap.py +52 -65
- torchzero/modules/adaptive/sophia_h.py +185 -0
- torchzero/modules/clipping/clipping.py +115 -25
- torchzero/modules/clipping/ema_clipping.py +31 -17
- torchzero/modules/clipping/growth_clipping.py +8 -7
- torchzero/modules/conjugate_gradient/__init__.py +11 -0
- torchzero/modules/conjugate_gradient/cg.py +355 -0
- torchzero/modules/experimental/__init__.py +13 -19
- torchzero/modules/{projections → experimental}/dct.py +11 -11
- torchzero/modules/{projections → experimental}/fft.py +10 -10
- torchzero/modules/experimental/gradmin.py +4 -3
- torchzero/modules/experimental/l_infinity.py +111 -0
- torchzero/modules/{momentum/experimental.py → experimental/momentum.py} +5 -42
- torchzero/modules/experimental/newton_solver.py +79 -17
- torchzero/modules/experimental/newtonnewton.py +32 -15
- torchzero/modules/experimental/reduce_outward_lr.py +4 -4
- torchzero/modules/experimental/scipy_newton_cg.py +105 -0
- torchzero/modules/{projections/structural.py → experimental/structural_projections.py} +13 -55
- torchzero/modules/functional.py +52 -6
- torchzero/modules/grad_approximation/fdm.py +30 -4
- torchzero/modules/grad_approximation/forward_gradient.py +16 -4
- torchzero/modules/grad_approximation/grad_approximator.py +51 -10
- torchzero/modules/grad_approximation/rfdm.py +321 -52
- torchzero/modules/higher_order/__init__.py +1 -1
- torchzero/modules/higher_order/higher_order_newton.py +164 -93
- torchzero/modules/least_squares/__init__.py +1 -0
- torchzero/modules/least_squares/gn.py +161 -0
- torchzero/modules/line_search/__init__.py +4 -4
- torchzero/modules/line_search/_polyinterp.py +289 -0
- torchzero/modules/line_search/adaptive.py +124 -0
- torchzero/modules/line_search/backtracking.py +95 -57
- torchzero/modules/line_search/line_search.py +171 -22
- torchzero/modules/line_search/scipy.py +3 -3
- torchzero/modules/line_search/strong_wolfe.py +327 -199
- torchzero/modules/misc/__init__.py +35 -0
- torchzero/modules/misc/debug.py +48 -0
- torchzero/modules/misc/escape.py +62 -0
- torchzero/modules/misc/gradient_accumulation.py +136 -0
- torchzero/modules/misc/homotopy.py +59 -0
- torchzero/modules/misc/misc.py +383 -0
- torchzero/modules/misc/multistep.py +194 -0
- torchzero/modules/misc/regularization.py +167 -0
- torchzero/modules/misc/split.py +123 -0
- torchzero/modules/{ops → misc}/switch.py +45 -4
- torchzero/modules/momentum/__init__.py +1 -5
- torchzero/modules/momentum/averaging.py +9 -9
- torchzero/modules/momentum/cautious.py +51 -19
- torchzero/modules/momentum/momentum.py +37 -2
- torchzero/modules/ops/__init__.py +11 -31
- torchzero/modules/ops/accumulate.py +6 -10
- torchzero/modules/ops/binary.py +81 -34
- torchzero/modules/{momentum/ema.py → ops/higher_level.py} +16 -39
- torchzero/modules/ops/multi.py +82 -21
- torchzero/modules/ops/reduce.py +16 -8
- torchzero/modules/ops/unary.py +29 -13
- torchzero/modules/ops/utility.py +30 -18
- torchzero/modules/projections/__init__.py +2 -4
- torchzero/modules/projections/cast.py +51 -0
- torchzero/modules/projections/galore.py +3 -1
- torchzero/modules/projections/projection.py +190 -96
- torchzero/modules/quasi_newton/__init__.py +9 -14
- torchzero/modules/quasi_newton/damping.py +105 -0
- torchzero/modules/quasi_newton/diagonal_quasi_newton.py +167 -0
- torchzero/modules/quasi_newton/lbfgs.py +286 -173
- torchzero/modules/quasi_newton/lsr1.py +185 -106
- torchzero/modules/quasi_newton/quasi_newton.py +816 -268
- torchzero/modules/restarts/__init__.py +7 -0
- torchzero/modules/restarts/restars.py +252 -0
- torchzero/modules/second_order/__init__.py +3 -2
- torchzero/modules/second_order/multipoint.py +238 -0
- torchzero/modules/second_order/newton.py +292 -68
- torchzero/modules/second_order/newton_cg.py +365 -15
- torchzero/modules/second_order/nystrom.py +104 -1
- torchzero/modules/smoothing/__init__.py +1 -1
- torchzero/modules/smoothing/laplacian.py +14 -4
- torchzero/modules/smoothing/sampling.py +300 -0
- torchzero/modules/step_size/__init__.py +2 -0
- torchzero/modules/step_size/adaptive.py +387 -0
- torchzero/modules/step_size/lr.py +154 -0
- torchzero/modules/termination/__init__.py +14 -0
- torchzero/modules/termination/termination.py +207 -0
- torchzero/modules/trust_region/__init__.py +5 -0
- torchzero/modules/trust_region/cubic_regularization.py +170 -0
- torchzero/modules/trust_region/dogleg.py +92 -0
- torchzero/modules/trust_region/levenberg_marquardt.py +128 -0
- torchzero/modules/trust_region/trust_cg.py +97 -0
- torchzero/modules/trust_region/trust_region.py +350 -0
- torchzero/modules/variance_reduction/__init__.py +1 -0
- torchzero/modules/variance_reduction/svrg.py +208 -0
- torchzero/modules/weight_decay/__init__.py +1 -1
- torchzero/modules/weight_decay/weight_decay.py +94 -11
- torchzero/modules/wrappers/optim_wrapper.py +29 -1
- torchzero/modules/zeroth_order/__init__.py +1 -0
- torchzero/modules/zeroth_order/cd.py +359 -0
- torchzero/optim/root.py +65 -0
- torchzero/optim/utility/split.py +8 -8
- torchzero/optim/wrappers/directsearch.py +39 -3
- torchzero/optim/wrappers/fcmaes.py +24 -15
- torchzero/optim/wrappers/mads.py +5 -6
- torchzero/optim/wrappers/nevergrad.py +16 -1
- torchzero/optim/wrappers/nlopt.py +0 -2
- torchzero/optim/wrappers/optuna.py +3 -3
- torchzero/optim/wrappers/scipy.py +86 -25
- torchzero/utils/__init__.py +40 -4
- torchzero/utils/compile.py +1 -1
- torchzero/utils/derivatives.py +126 -114
- torchzero/utils/linalg/__init__.py +9 -2
- torchzero/utils/linalg/linear_operator.py +329 -0
- torchzero/utils/linalg/matrix_funcs.py +2 -2
- torchzero/utils/linalg/orthogonalize.py +2 -1
- torchzero/utils/linalg/qr.py +2 -2
- torchzero/utils/linalg/solve.py +369 -58
- torchzero/utils/metrics.py +83 -0
- torchzero/utils/numberlist.py +2 -0
- torchzero/utils/python_tools.py +16 -0
- torchzero/utils/tensorlist.py +134 -51
- torchzero/utils/torch_tools.py +9 -4
- torchzero-0.3.13.dist-info/METADATA +14 -0
- torchzero-0.3.13.dist-info/RECORD +166 -0
- {torchzero-0.3.10.dist-info → torchzero-0.3.13.dist-info}/top_level.txt +0 -1
- docs/source/conf.py +0 -57
- torchzero/modules/experimental/absoap.py +0 -250
- torchzero/modules/experimental/adadam.py +0 -112
- torchzero/modules/experimental/adamY.py +0 -125
- torchzero/modules/experimental/adasoap.py +0 -172
- torchzero/modules/experimental/diagonal_higher_order_newton.py +0 -225
- torchzero/modules/experimental/eigendescent.py +0 -117
- torchzero/modules/experimental/etf.py +0 -172
- torchzero/modules/experimental/soapy.py +0 -163
- torchzero/modules/experimental/structured_newton.py +0 -111
- torchzero/modules/experimental/subspace_preconditioners.py +0 -138
- torchzero/modules/experimental/tada.py +0 -38
- torchzero/modules/line_search/trust_region.py +0 -73
- torchzero/modules/lr/__init__.py +0 -2
- torchzero/modules/lr/adaptive.py +0 -93
- torchzero/modules/lr/lr.py +0 -63
- torchzero/modules/momentum/matrix_momentum.py +0 -166
- torchzero/modules/ops/debug.py +0 -25
- torchzero/modules/ops/misc.py +0 -418
- torchzero/modules/ops/split.py +0 -75
- torchzero/modules/optimizers/__init__.py +0 -18
- torchzero/modules/optimizers/adagrad.py +0 -155
- torchzero/modules/optimizers/sophia_h.py +0 -129
- torchzero/modules/quasi_newton/cg.py +0 -268
- torchzero/modules/quasi_newton/experimental/__init__.py +0 -1
- torchzero/modules/quasi_newton/experimental/modular_lbfgs.py +0 -266
- torchzero/modules/quasi_newton/olbfgs.py +0 -196
- torchzero/modules/smoothing/gaussian.py +0 -164
- torchzero-0.3.10.dist-info/METADATA +0 -379
- torchzero-0.3.10.dist-info/RECORD +0 -139
- torchzero-0.3.10.dist-info/licenses/LICENSE +0 -21
- {torchzero-0.3.10.dist-info → torchzero-0.3.13.dist-info}/WHEEL +0 -0
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: torchzero
|
|
3
|
-
Version: 0.3.10
|
|
4
|
-
Summary: Modular optimization library for PyTorch.
|
|
5
|
-
Author-email: Ivan Nikishev <nkshv2@gmail.com>
|
|
6
|
-
License: MIT License
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2024 inikishev
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
|
18
|
-
copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
-
SOFTWARE.
|
|
27
|
-
|
|
28
|
-
Project-URL: Homepage, https://github.com/inikishev/torchzero
|
|
29
|
-
Project-URL: Repository, https://github.com/inikishev/torchzero
|
|
30
|
-
Project-URL: Issues, https://github.com/inikishev/torchzero/isses
|
|
31
|
-
Keywords: optimization,optimizers,torch,neural networks,zeroth order,second order
|
|
32
|
-
Requires-Python: >=3.10
|
|
33
|
-
Description-Content-Type: text/markdown
|
|
34
|
-
License-File: LICENSE
|
|
35
|
-
Requires-Dist: torch
|
|
36
|
-
Requires-Dist: numpy
|
|
37
|
-
Requires-Dist: typing_extensions
|
|
38
|
-
Dynamic: license-file
|
|
39
|
-
|
|
40
|
-

|
|
41
|
-
|
|
42
|
-
# torchzero
|
|
43
|
-
|
|
44
|
-
**Modular optimization library for PyTorch**
|
|
45
|
-
|
|
46
|
-
`torchzero` is a PyTorch library providing a highly modular framework for creating and experimenting with a huge number of various optimization algorithms - various momentum techniques, gradient clipping, gradient approximations, line searches, quasi newton methods and more. All algorithms are implemented as modules that can be chained together freely.
|
|
47
|
-
|
|
48
|
-
NOTE: torchzero is in active development, currently docs are in a state of flux.
|
|
49
|
-
|
|
50
|
-
## Installation
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
pip install torchzero
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
pip version is always the latest one. Or install from this repo
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
pip install git+https://github.com/inikishev/torchzero
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
**Dependencies:**
|
|
63
|
-
|
|
64
|
-
* Python >= 3.10
|
|
65
|
-
* `torch`
|
|
66
|
-
* `numpy`
|
|
67
|
-
* `typing_extensions`
|
|
68
|
-
|
|
69
|
-
## Quick Start / Usage Example
|
|
70
|
-
|
|
71
|
-
Basic example:
|
|
72
|
-
|
|
73
|
-
```python
|
|
74
|
-
import torch
|
|
75
|
-
from torch import nn
|
|
76
|
-
import torchzero as tz
|
|
77
|
-
|
|
78
|
-
# Define a simple model
|
|
79
|
-
model = nn.Linear(10, 1)
|
|
80
|
-
criterion = nn.MSELoss()
|
|
81
|
-
inputs = torch.randn(5, 10)
|
|
82
|
-
targets = torch.randn(5, 1)
|
|
83
|
-
|
|
84
|
-
# Create an optimizer
|
|
85
|
-
# The order of modules matters:
|
|
86
|
-
# 1. ClipValue: clips gradients to (-10, 10) range.
|
|
87
|
-
# 2. Adam: applies Adam update rule to clipped gradients.
|
|
88
|
-
# 3. NormalizeByEMA: stabilizes the update by normalizing it to an exponential
|
|
89
|
-
# moving average of past updates.
|
|
90
|
-
# 4. WeightDecay - decoupled weight decay (can also move after LR to fully decouple)
|
|
91
|
-
# 5. LR: Scales the computed update by the learning rate (supports LR schedulers).
|
|
92
|
-
optimizer = tz.Modular(
|
|
93
|
-
model.parameters(),
|
|
94
|
-
tz.m.ClipValue(10),
|
|
95
|
-
tz.m.Adam(),
|
|
96
|
-
tz.m.NormalizeByEMA(max_ema_growth=1.1),
|
|
97
|
-
tz.m.WeightDecay(1e-4),
|
|
98
|
-
tz.m.LR(1e-1),
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
# Standard training loop
|
|
102
|
-
for epoch in range(100):
|
|
103
|
-
optimizer.zero_grad()
|
|
104
|
-
output = model(inputs)
|
|
105
|
-
loss = criterion(output, targets)
|
|
106
|
-
loss.backward()
|
|
107
|
-
optimizer.step()
|
|
108
|
-
if (epoch+1) % 10 == 0: print(f"Epoch {epoch+1}, Loss: {loss.item()}")
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
## Overview of Available Modules
|
|
112
|
-
|
|
113
|
-
`torchzero` provides a huge number of various modules:
|
|
114
|
-
|
|
115
|
-
* **Optimizers**: Optimization algorithms.
|
|
116
|
-
* `Adam`.
|
|
117
|
-
* `Shampoo`.
|
|
118
|
-
* `SOAP` (my current recommendation).
|
|
119
|
-
* `Muon`.
|
|
120
|
-
* `SophiaH`.
|
|
121
|
-
* `Adagrad` and `FullMatrixAdagrad`.
|
|
122
|
-
* `Lion`.
|
|
123
|
-
* `RMSprop`.
|
|
124
|
-
* `OrthoGrad`.
|
|
125
|
-
* `Rprop`.
|
|
126
|
-
|
|
127
|
-
Additionally many other optimizers can be easily defined via modules:
|
|
128
|
-
* Grams: `[tz.m.Adam(), tz.m.GradSign()]`
|
|
129
|
-
* LaProp: `[tz.m.RMSprop(), tz.m.EMA(0.9)]`
|
|
130
|
-
* Signum: `[tz.m.HeavyBall(), tz.m.Sign()]`
|
|
131
|
-
* Full matrix version of any diagonal optimizer, like Adam: `tz.m.FullMatrixAdagrad(beta=0.999, inner=tz.m.EMA(0.9))`
|
|
132
|
-
* Cautious version of any optimizer, like SOAP: `[tz.m.SOAP(), tz.m.Cautious()]`
|
|
133
|
-
|
|
134
|
-
* **Momentum**:
|
|
135
|
-
* `NAG`: Nesterov Accelerated Gradient.
|
|
136
|
-
* `HeavyBall`: Classic momentum (Polyak's momentum).
|
|
137
|
-
* `EMA`: Exponential moving average.
|
|
138
|
-
* `Averaging` (`Medianveraging`, `WeightedAveraging`): Simple, median, or weighted averaging of updates.
|
|
139
|
-
* `Cautious`, `ScaleByGradCosineSimilarity`: Momentum cautioning.
|
|
140
|
-
* `MatrixMomentum`, `AdaptiveMatrixMomentum`: Second order momentum.
|
|
141
|
-
|
|
142
|
-
* **Stabilization**: Gradient stabilization techniques.
|
|
143
|
-
* `ClipNorm`: Clips gradient L2 norm.
|
|
144
|
-
* `ClipValue`: Clips gradient values element-wise.
|
|
145
|
-
* `Normalize`: Normalizes gradients to unit norm.
|
|
146
|
-
* `Centralize`: Centralizes gradients by subtracting the mean.
|
|
147
|
-
* `ClipNormByEMA`, `NormalizeByEMA`, `ClipValueByEMA`: Clipping/Normalization based on EMA of past values.
|
|
148
|
-
* `ClipNormGrowth`, `ClipValueGrowth`: Limits norm or value growth.
|
|
149
|
-
|
|
150
|
-
* **Gradient approximations**: Methods for approximating gradients.
|
|
151
|
-
* `FDM`: Finite difference method.
|
|
152
|
-
* `RandomizedFDM` (`MeZO`, `SPSA`, `RDSA`, `Gaussian smoothing`): Randomized finite difference methods (also subspaces).
|
|
153
|
-
* `ForwardGradient`: Randomized gradient approximation via forward mode automatic differentiation.
|
|
154
|
-
|
|
155
|
-
* **Second order**: Second order methods.
|
|
156
|
-
* `Newton`: Classic Newton's method.
|
|
157
|
-
* `NewtonCG`: Matrix-free newton's method with conjugate gradient solver.
|
|
158
|
-
* `NystromSketchAndSolve`: Nyström sketch-and-solve method.
|
|
159
|
-
* `NystromPCG`: NewtonCG with Nyström preconditioning (usually beats NewtonCG).
|
|
160
|
-
* `HigherOrderNewton`: Higher order Newton's method with trust region.
|
|
161
|
-
|
|
162
|
-
* **Quasi-Newton**: Approximate second-order optimization methods.
|
|
163
|
-
* `LBFGS`: Limited-memory BFGS.
|
|
164
|
-
* `LSR1`: Limited-memory SR1.
|
|
165
|
-
* `OnlineLBFGS`: Online LBFGS.
|
|
166
|
-
* `BFGS`, `DFP`, `PSB`, `SR1`, `SSVM`, `BroydenBad`, `BroydenGood`, `ColumnUpdatingMethod`, `FletcherVMM`, `GradientCorrection`, `Greenstadt1`, `Greenstadt2`, `Horisho`, `McCormick`, `Pearson`, `ProjectedNewtonRaphson`, `ThomasOptimalMethod`: Classic full-matrix quasi-newton methods.
|
|
167
|
-
* `PolakRibiere`, `FletcherReeves`, `HestenesStiefel`, `DaiYuan`, `LiuStorey`, `ConjugateDescent`, `HagerZhang`, `HybridHS_DY`, `ProjectedGradientMethod`: Conjugate gradient methods.
|
|
168
|
-
|
|
169
|
-
* **Line Search**:
|
|
170
|
-
* `Backtracking`, `AdaptiveBacktracking`: Backtracking line searches (adaptive is my own).
|
|
171
|
-
* `StrongWolfe`: Cubic interpolation line search satisfying strong Wolfe conditions.
|
|
172
|
-
* `ScipyMinimizeScalar`: Wrapper for SciPy's scalar minimization for line search.
|
|
173
|
-
* `TrustRegion`: First order trust region method.
|
|
174
|
-
|
|
175
|
-
* **Learning Rate**:
|
|
176
|
-
* `LR`: Controls learning rate and adds support for LR schedulers.
|
|
177
|
-
* `PolyakStepSize`: Polyak's method.
|
|
178
|
-
* `Warmup`: Learning rate warmup.
|
|
179
|
-
|
|
180
|
-
* **Projections**: This can implement things like GaLore but I haven't done that yet.
|
|
181
|
-
* `FFTProjection`, `DCTProjection`: Use any update rule in Fourier or DCT domain (doesn't seem to help though).
|
|
182
|
-
* `VectorProjection`, `TensorizeProjection`, `BlockPartition`, `TensorNormsProjection`: Structural projection methods (for block BFGS etc.).
|
|
183
|
-
|
|
184
|
-
* **Smoothing**: Smoothing-based optimization methods.
|
|
185
|
-
* `LaplacianSmoothing`: Laplacian smoothing for gradients (implements Laplacian Smooth GD).
|
|
186
|
-
* `GaussianHomotopy`: Smoothing via randomized Gaussian homotopy.
|
|
187
|
-
|
|
188
|
-
* **Weight Decay**:.
|
|
189
|
-
* `WeightDecay`: Standard L2 or L1 weight decay.
|
|
190
|
-
|
|
191
|
-
* **Ops**: This has low level operations, also stuff like grafting and gradient accumulation.
|
|
192
|
-
|
|
193
|
-
* **Wrappers**.
|
|
194
|
-
* `Wrap`: Wraps any PyTorch optimizer, allowing to use it as a module.
|
|
195
|
-
|
|
196
|
-
* **Experimental**: various horrible atrocities
|
|
197
|
-
|
|
198
|
-
## Advanced Usage
|
|
199
|
-
|
|
200
|
-
### Closure
|
|
201
|
-
|
|
202
|
-
Certain modules, particularly line searches and gradient approximations require a closure, similar to L-BFGS in PyTorch. Also some modules require closure to accept an additional `backward` argument, refer to example below:
|
|
203
|
-
|
|
204
|
-
```python
|
|
205
|
-
# basic training loop
|
|
206
|
-
for inputs, targets in dataloader:
|
|
207
|
-
|
|
208
|
-
def closure(backward=True): # make sure it is True by default
|
|
209
|
-
preds = model(inputs)
|
|
210
|
-
loss = criterion(preds, targets)
|
|
211
|
-
|
|
212
|
-
if backward: # gradient approximations always call with backward=False.
|
|
213
|
-
optimizer.zero_grad()
|
|
214
|
-
loss.backward()
|
|
215
|
-
|
|
216
|
-
return loss
|
|
217
|
-
|
|
218
|
-
loss = optimizer.step(closure)
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
The code above will also work with any other optimizer because all PyTorch optimizers and most custom ones support closure, so there is no need to rewrite training loop.
|
|
222
|
-
|
|
223
|
-
Non-batched example (rosenbrock):
|
|
224
|
-
|
|
225
|
-
```py
|
|
226
|
-
import torchzero as tz
|
|
227
|
-
|
|
228
|
-
def rosen(x, y):
|
|
229
|
-
return (1 - x) ** 2 + 100 * (y - x ** 2) ** 2
|
|
230
|
-
|
|
231
|
-
W = torch.tensor([-1.1, 2.5], requires_grad=True)
|
|
232
|
-
|
|
233
|
-
def closure(backward=True):
|
|
234
|
-
loss = rosen(*W)
|
|
235
|
-
if backward:
|
|
236
|
-
W.grad = None # same as opt.zero_grad()
|
|
237
|
-
loss.backward()
|
|
238
|
-
return loss
|
|
239
|
-
|
|
240
|
-
opt = tz.Modular([W], tz.m.NewtonCG(), tz.m.StrongWolfe())
|
|
241
|
-
for step in range(20):
|
|
242
|
-
loss = opt.step(closure)
|
|
243
|
-
print(f'{step} - {loss}')
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
### Module combinations
|
|
247
|
-
|
|
248
|
-
There are practically no rules to the ordering of the modules - anything will work. For example any method can be made zeroth order by putting it after some gradient approximation module such as GaussianSmoothing:
|
|
249
|
-
|
|
250
|
-
```python
|
|
251
|
-
opt = tz.Modular(
|
|
252
|
-
bench.parameters(),
|
|
253
|
-
tz.m.GaussianSmoothing(h=0.01, n_samples=10),
|
|
254
|
-
tz.m.NewtonCG(hvp_method='forward'),
|
|
255
|
-
tz.m.AdaptiveBacktracking(),
|
|
256
|
-
)
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
GaussianSmoothing actually creates a new **closure** which approximates the gradient. To NewtonCG this closure is just like
|
|
260
|
-
any other closure, so it works seamlessly.
|
|
261
|
-
|
|
262
|
-
Any module can be projected (this is how it will work once I implement GaLore, but I haven't done that yet):
|
|
263
|
-
|
|
264
|
-
```python
|
|
265
|
-
tz.m.GaLore([tz.m.GraftModules(tz.m.Shampoo(), tz.m.RMSprop()), tz.m.LR(1e-2)])
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
### Low level modules
|
|
269
|
-
|
|
270
|
-
torchzero provides a lot of low-level modules that can be used to recreate update rules, or combine existing update rules
|
|
271
|
-
in new ways. Here are some equivalent ways to make Adam in order of their involvement:
|
|
272
|
-
|
|
273
|
-
```python
|
|
274
|
-
tz.m.Adam()
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
```python
|
|
278
|
-
# Adam is debiased RMSprop applied to EMA
|
|
279
|
-
tz.m.RMSprop(0.999, debiased=True, init='zeros', inner=tz.m.EMA(0.9))
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
```python
|
|
283
|
-
tz.m.DivModules(
|
|
284
|
-
tz.m.EMA(0.9, debiased=True),
|
|
285
|
-
[tz.m.SqrtEMASquared(0.999, debiased=True), tz.m.Add(1e-8)]
|
|
286
|
-
)
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
```python
|
|
290
|
-
tz.m.DivModules(
|
|
291
|
-
[tz.m.EMA(0.9), tz.m.Debias(beta1=0.9, beta2=0.999)],
|
|
292
|
-
[tz.m.EMASquared(0.999), tz.m.Sqrt(), tz.m.Add(1e-8)]
|
|
293
|
-
)
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
```python
|
|
297
|
-
tz.m.DivModules(
|
|
298
|
-
[tz.m.EMA(0.9), tz.m.Debias(beta1=0.9)],
|
|
299
|
-
[
|
|
300
|
-
tz.m.Pow(2),
|
|
301
|
-
tz.m.EMA(0.999),
|
|
302
|
-
tz.m.AccumulateMaximum() if amsgrad else tz.m.Identity(),
|
|
303
|
-
tz.m.Sqrt(),
|
|
304
|
-
tz.m.Debias2(beta=0.999),
|
|
305
|
-
tz.m.Add(1e-8)]
|
|
306
|
-
)
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
### Quick guide to implementing new modules
|
|
310
|
-
|
|
311
|
-
Modules are quite similar to torch.optim.Optimizer, the main difference is that everything is stored in the Vars object,
|
|
312
|
-
not in the module itself. Also both per-parameter settings and state are stored in per-parameter dictionaries. Feel free to modify the example below.
|
|
313
|
-
|
|
314
|
-
```python
|
|
315
|
-
import torch
|
|
316
|
-
from torchzero.core import Module, Var
|
|
317
|
-
|
|
318
|
-
class HeavyBall(Module):
|
|
319
|
-
def __init__(self, momentum: float = 0.9, dampening: float = 0):
|
|
320
|
-
defaults = dict(momentum=momentum, dampening=dampening)
|
|
321
|
-
super().__init__(defaults)
|
|
322
|
-
|
|
323
|
-
def step(self, var: Var):
|
|
324
|
-
# a module takes a Var object, modifies it or creates a new one, and returns it
|
|
325
|
-
# Var has a bunch of attributes, including parameters, gradients, update, closure, loss
|
|
326
|
-
# for now we are only interested in update, and we will apply the heavyball rule to it.
|
|
327
|
-
|
|
328
|
-
params = var.params
|
|
329
|
-
update = var.get_update() # list of tensors
|
|
330
|
-
|
|
331
|
-
exp_avg_list = []
|
|
332
|
-
for p, u in zip(params, update):
|
|
333
|
-
state = self.state[p]
|
|
334
|
-
settings = self.settings[p]
|
|
335
|
-
momentum = settings['momentum']
|
|
336
|
-
dampening = settings['dampening']
|
|
337
|
-
|
|
338
|
-
if 'momentum_buffer' not in state:
|
|
339
|
-
state['momentum_buffer'] = torch.zeros_like(p)
|
|
340
|
-
|
|
341
|
-
buf = state['momentum_buffer']
|
|
342
|
-
u *= 1 - dampening
|
|
343
|
-
|
|
344
|
-
buf.mul_(momentum).add_(u)
|
|
345
|
-
|
|
346
|
-
# clone because further modules might modify exp_avg in-place
|
|
347
|
-
# and it is part of self.state
|
|
348
|
-
exp_avg_list.append(buf.clone())
|
|
349
|
-
|
|
350
|
-
# set new update to var
|
|
351
|
-
var.update = exp_avg_list
|
|
352
|
-
return var
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
There are a some specialized base modules that make it much easier to implement some specific things.
|
|
356
|
-
|
|
357
|
-
* `GradApproximator` for gradient approximations
|
|
358
|
-
* `LineSearch` for line searches
|
|
359
|
-
* `Projection` for projections like GaLore or into fourier domain.
|
|
360
|
-
* `QuasiNewtonH` for full-matrix quasi-newton methods that update hessian inverse approximation (because they are all very similar)
|
|
361
|
-
* `ConguateGradientBase` for conjugate gradient methods, basically the only difference is how beta is calculated.
|
|
362
|
-
|
|
363
|
-
The documentation on how to actually use them is to write itself in the near future.
|
|
364
|
-
|
|
365
|
-
## License
|
|
366
|
-
|
|
367
|
-
This project is licensed under the MIT License
|
|
368
|
-
|
|
369
|
-
## Project Links
|
|
370
|
-
|
|
371
|
-
TODO (there are docs but from very old version)
|
|
372
|
-
|
|
373
|
-
## Other stuff
|
|
374
|
-
|
|
375
|
-
There are also wrappers providing `torch.optim.Optimizer` interface for for `scipy.optimize`, NLOpt and Nevergrad.
|
|
376
|
-
|
|
377
|
-
They are in `torchzero.optim.wrappers.scipy.ScipyMinimize`, `torchzero.optim.wrappers.nlopt.NLOptOptimizer`, and `torchzero.optim.wrappers.nevergrad.NevergradOptimizer`. Make sure closure has `backward` argument as described in **Advanced Usage**.
|
|
378
|
-
|
|
379
|
-
Apparently <https://github.com/avaneev/biteopt> is diabolical so I will add a wrapper for it too very soon.
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
docs/source/conf.py,sha256=jd80ZT2IdCx7nlQrpOTJL8UhGBNm6KYyXlpp0jmRiAw,1849
|
|
2
|
-
tests/test_identical.py,sha256=NZ7A8Rm1U9Q16d-cG2G_wccpPtNALyoKYJt9qMownMc,11568
|
|
3
|
-
tests/test_module.py,sha256=qX3rjdSJsbA8JO17bPTUIDspe7bg2dogqxMw__KV7SU,2039
|
|
4
|
-
tests/test_opts.py,sha256=VSko5fUuACo_y6iab_akke0gMhCUEEUJ9ahpBqWBoM4,41715
|
|
5
|
-
tests/test_tensorlist.py,sha256=SwzLKLrs2ppMtm_7UrfTDTlD-ObZd7JQ_FNHbp059tc,72460
|
|
6
|
-
tests/test_utils_optimizer.py,sha256=bvC0Ehvs2L8fohpyIF5Vfr9OKTycpnODWLPflXilU1c,8414
|
|
7
|
-
tests/test_vars.py,sha256=MqCJXrbj-C75APm1heykzcEWewinihlSjekkYDx-TFk,6726
|
|
8
|
-
torchzero/__init__.py,sha256=L7IJ1qZ3o8E9oRwlJZBK2_2yII_eeGEk57Of6EfVbrk,112
|
|
9
|
-
torchzero/core/__init__.py,sha256=Zib_4is13LFAabp_7VU8QXZpQEEZGzsH94vgRI0HxAg,150
|
|
10
|
-
torchzero/core/module.py,sha256=Yfzn48dDbxYZJLpWnLYFIbqBb4sB3GekSZ7QGIplYAg,27525
|
|
11
|
-
torchzero/core/transform.py,sha256=yK1wYgp03THzRN9y_f9-5q2nonEZMa0CfDFAdOxnqEU,11778
|
|
12
|
-
torchzero/modules/__init__.py,sha256=8C73_dFzfWUWhii1UF86FUy8x75RPiAVLAm4sLTikBg,359
|
|
13
|
-
torchzero/modules/functional.py,sha256=HXNzmPe7LsPadryEm7zrcEKqGej16QDwSgBkbEvggFM,6492
|
|
14
|
-
torchzero/modules/clipping/__init__.py,sha256=ZaffMF7mIRK6hZSfuZadgjNTX6hF5ANiLBny2w3S7I8,250
|
|
15
|
-
torchzero/modules/clipping/clipping.py,sha256=XKFKvzNgsvuYUmvHyulE6PkZv_aeLQjp0CgtFj0013s,12516
|
|
16
|
-
torchzero/modules/clipping/ema_clipping.py,sha256=MGouZEN0BorliHAZhue0afhC3AhZJ6wrnwBRzDTHjX4,5978
|
|
17
|
-
torchzero/modules/clipping/growth_clipping.py,sha256=50c1YOUPVL8eWzH6zJINnNP68oiZkDcq7rR6HnWjVFc,6674
|
|
18
|
-
torchzero/modules/experimental/__init__.py,sha256=zxxNKPZHnkVnx1ZjKNX_nkV4Wc_EdODM6qJGn7Pgb3w,766
|
|
19
|
-
torchzero/modules/experimental/absoap.py,sha256=-KwQXmI12hvHbMGPHM0APAxDQztlFhlSOG55KK6PvpI,9901
|
|
20
|
-
torchzero/modules/experimental/adadam.py,sha256=o0KPLaF4J7L_Ty71RNgsysk6IEuC4DRE5nGQkGIP_dA,4078
|
|
21
|
-
torchzero/modules/experimental/adamY.py,sha256=LZabWX_vccDaG6_UVZl9ALJ-3nCZu-NEygJQ_Bwzel8,4018
|
|
22
|
-
torchzero/modules/experimental/adasoap.py,sha256=XtxEvBWYdcqfWnQqOFa_-SrOwd_nXHzLftiw-YXDACQ,7408
|
|
23
|
-
torchzero/modules/experimental/curveball.py,sha256=JdgojuSYLNe9u3bmqcYrFm8brUD4kvKm9XYx78GzpKI,3257
|
|
24
|
-
torchzero/modules/experimental/diagonal_higher_order_newton.py,sha256=u4-a5qJ_97XiZUDlClE2cASkBsx_NTJNPk6BWWybiqE,7158
|
|
25
|
-
torchzero/modules/experimental/eigendescent.py,sha256=0cM1p4rYbrpwBNXgBEMblVyX0xBWTzojSC1EsUnXH6k,4707
|
|
26
|
-
torchzero/modules/experimental/etf.py,sha256=FsLOCmQf24PPoRf5wsRUjVqk32uW9uTzaf1ERjFxRK8,5744
|
|
27
|
-
torchzero/modules/experimental/gradmin.py,sha256=UixSLdca4ekYHOipEivdXfBAV-uEL9TZm5nCFXVaNco,3684
|
|
28
|
-
torchzero/modules/experimental/newton_solver.py,sha256=3dZ7FG-2vGxJKkFF9P2LCs-LI_epcvZbyNtJOtw47pg,3055
|
|
29
|
-
torchzero/modules/experimental/newtonnewton.py,sha256=QCGnY_CFo0i_NUB7D-6ezeNpG6wLkTD5lHBiakFIqbM,3033
|
|
30
|
-
torchzero/modules/experimental/reduce_outward_lr.py,sha256=VFjcTpmLwpfhUR8u_5rbzPgHVR6K3fvti7jVy1DnsYU,1300
|
|
31
|
-
torchzero/modules/experimental/soapy.py,sha256=7qsh9Y9U9oeQDwuDSVqnz71AD0nUYY3q0XN2XoMFWaw,6721
|
|
32
|
-
torchzero/modules/experimental/spectral.py,sha256=SN7tToIpmna0IZ1NgObvqEbO48NnVbwqRwKi8ROsb7s,7374
|
|
33
|
-
torchzero/modules/experimental/structured_newton.py,sha256=CWfVJ2LPZUuz1bMnlgOM6tlYPd2etjgLDIcyAfAG_y8,3464
|
|
34
|
-
torchzero/modules/experimental/subspace_preconditioners.py,sha256=9Tl1PCN9crFUvVn6343GHoI3kv6CVnUWP1dfhwUvAFU,5130
|
|
35
|
-
torchzero/modules/experimental/tada.py,sha256=84YcLhG34CbWq84L-AUj-A4uxpzdIVayaARHRm2f9b8,1564
|
|
36
|
-
torchzero/modules/grad_approximation/__init__.py,sha256=DVFjf0cXuF70NA0nJ2WklpP01PQgrRZxUjUQjjQeSos,195
|
|
37
|
-
torchzero/modules/grad_approximation/fdm.py,sha256=cUgy98Bz0Br4q6ViNxn6EVOZX2jE0nDXVZLUGhxpDcA,3589
|
|
38
|
-
torchzero/modules/grad_approximation/forward_gradient.py,sha256=cNgx8kc8r0fWj8xdU2b85W3fenNDQZKuIsJLM3UzSig,3867
|
|
39
|
-
torchzero/modules/grad_approximation/grad_approximator.py,sha256=TODFUwBgTmjfbnO6Sc833fnvYzYaqqYTEba_13s-qOI,2906
|
|
40
|
-
torchzero/modules/grad_approximation/rfdm.py,sha256=VsRlf95JnG6HdlIsJANcfJjMk7c_B9a5-fH9dSTBA10,11328
|
|
41
|
-
torchzero/modules/higher_order/__init__.py,sha256=W94CY8K1NFxs9TPi415UssKVKz5MV_bH9adax1uZsYM,50
|
|
42
|
-
torchzero/modules/higher_order/higher_order_newton.py,sha256=BwiSlcGobam04SgWFcB1p_-TSuzu2rWgGVnmvP6Si9k,9751
|
|
43
|
-
torchzero/modules/line_search/__init__.py,sha256=nkOUPLe88wE91ICEhprl2pJsvaKtbI3KzYOdT83AGsg,253
|
|
44
|
-
torchzero/modules/line_search/backtracking.py,sha256=ZgeLAYqrw-6BeEGp8wmOgFoLtUKROF7w7LpAREe0xZU,7704
|
|
45
|
-
torchzero/modules/line_search/line_search.py,sha256=CfOENZgAPSdyv1wvSbhw6gdpfbQnXGdOnLsq29wjvzU,7229
|
|
46
|
-
torchzero/modules/line_search/scipy.py,sha256=SvDCZ1DPOLZcSeOFvf3tXAf1ty-9qRVfGFMWVF5q708,2293
|
|
47
|
-
torchzero/modules/line_search/strong_wolfe.py,sha256=xOU4XFekh4TIepm9ztJTYpcGucEMPwAeb_cDK4Rp0ho,7620
|
|
48
|
-
torchzero/modules/line_search/trust_region.py,sha256=xUZApOTW4uXFBk_Uq_YBktiXcoSAKdDc6O5vjTwquGw,3101
|
|
49
|
-
torchzero/modules/lr/__init__.py,sha256=kh2k_tma-oTOALR6AlD5XHdTPSMgU4A04Oa0hAqrEpI,89
|
|
50
|
-
torchzero/modules/lr/adaptive.py,sha256=6s06Gvu1UmoT89hrMkXvJWHkEOMNcy5mMiyxy3V9lQs,3904
|
|
51
|
-
torchzero/modules/lr/lr.py,sha256=1gU2QzMA5PV2KkzOkxxrZZKGcz-Kbjyp7WNurOM36ys,2655
|
|
52
|
-
torchzero/modules/momentum/__init__.py,sha256=pSD7vxu8PySrYOSHQMi3C9heYdcQr8y6WC_rwMybZm0,544
|
|
53
|
-
torchzero/modules/momentum/averaging.py,sha256=NmRodxsSekEDGIuFGDYOvJL-WkdMN3YF-naBdtfjxx8,3247
|
|
54
|
-
torchzero/modules/momentum/cautious.py,sha256=JuaFYfyf9S3nTcqeZz5ylXKepqi0eqglOAQ0uNG0eT8,7373
|
|
55
|
-
torchzero/modules/momentum/ema.py,sha256=qJV__nIbcD9e8qvwbvsATnYkQrdnmMiA91ju52IqSxw,10699
|
|
56
|
-
torchzero/modules/momentum/experimental.py,sha256=eYnP6NmBDegwX9XC_dYMJP3vquBpM1LyQc03v3vW6-8,6900
|
|
57
|
-
torchzero/modules/momentum/matrix_momentum.py,sha256=LR12UugXM8ocwTB8zBYpt03oZeZU0cb0UoFR6qO34V8,6818
|
|
58
|
-
torchzero/modules/momentum/momentum.py,sha256=4Pgk-3HM7Av_ILT6oXtvnM1CB1yit8AkFnYWLvnUAqs,2655
|
|
59
|
-
torchzero/modules/ops/__init__.py,sha256=hxMZFSXX7xvitXkuBiYykVGX3p03Xprm_QA2CMg4eW8,1601
|
|
60
|
-
torchzero/modules/ops/accumulate.py,sha256=yKNgw8ZsaVRPjuzPzLJOvALkjik0aWx30Eu91FefRoA,3741
|
|
61
|
-
torchzero/modules/ops/binary.py,sha256=98jyjkJ8BPuSH-mb4g2BnFi6UzvRZRf__Pt-jnD3pNU,9690
|
|
62
|
-
torchzero/modules/ops/debug.py,sha256=zueWyNVvaJmxRD8QG8m_ys9jc7zRfSr8GAuxqz5dDTI,851
|
|
63
|
-
torchzero/modules/ops/misc.py,sha256=GmnKDjMXaTUjPcC5e7Jftk6k2NQ0Ivv4ceUApxMckIQ,15978
|
|
64
|
-
torchzero/modules/ops/multi.py,sha256=T1aVaRr6bLWvjoj1cyxaDncROypT6rmmmji8mvBHczo,5713
|
|
65
|
-
torchzero/modules/ops/reduce.py,sha256=reGvusJyCzM8VdHbWyJRYFePPBXfVP0jZeXIEKGIJGc,5668
|
|
66
|
-
torchzero/modules/ops/split.py,sha256=eM4Qsz6pMNF22bk3NF2rtvyxSOt9U-EyYxMAyjvTrMQ,2265
|
|
67
|
-
torchzero/modules/ops/switch.py,sha256=ddsxq4bsH86iWW6mMdcQw3c0mU1s2FA-PRZpVOia7PY,2506
|
|
68
|
-
torchzero/modules/ops/unary.py,sha256=3ysDHXs6snsQNBj3c288BT8G6T30Nvo0QM3PcdfQ2ww,4888
|
|
69
|
-
torchzero/modules/ops/utility.py,sha256=8XFjQO4ghCmGD2H-lYTgaBzik_9pB3Uxt7xCxQrv5Ig,3080
|
|
70
|
-
torchzero/modules/optimizers/__init__.py,sha256=BbT2nhIt4p74t1cO8ziQgzqZHaLvyuleXQbccugd06M,554
|
|
71
|
-
torchzero/modules/optimizers/adagrad.py,sha256=NHpWcnIRM2LyPnNtDVTdluX4n1qqqWs9IHpFD8uYeLo,5500
|
|
72
|
-
torchzero/modules/optimizers/adam.py,sha256=u6ieXHn_lHZozmGiKhSA73pApI83eeTNIyOrxBTFL1o,4009
|
|
73
|
-
torchzero/modules/optimizers/lion.py,sha256=4yy6d0SLpGXndu8NCuYhdsNshMEYhONu_FPYXdupA_s,1119
|
|
74
|
-
torchzero/modules/optimizers/muon.py,sha256=exbp7wVpIryiOxmbf9RAfZ9a6XXuOWTUqdjn-i57Fq4,9628
|
|
75
|
-
torchzero/modules/optimizers/orthograd.py,sha256=cN5g7OusfeUlh0jn0kjkvpcVjqR01eGoi9WK1sSPnug,2021
|
|
76
|
-
torchzero/modules/optimizers/rmsprop.py,sha256=jM5ohfABYUljy2RrtG_bY9PMHNzSkROYjqFPxnlXE6o,4309
|
|
77
|
-
torchzero/modules/optimizers/rprop.py,sha256=d0R8UR-f9Pb64VrsJegrCyteLYa5TAmgObjgirqLaBo,11030
|
|
78
|
-
torchzero/modules/optimizers/shampoo.py,sha256=hmfgPghzmjmba3PH1vLzaz0lOvLiIX9rCKrT71YZb40,8420
|
|
79
|
-
torchzero/modules/optimizers/soap.py,sha256=7adybqncrkt31rNveQwXp8eeZKWf0LDhC5wt7GbmDcM,11052
|
|
80
|
-
torchzero/modules/optimizers/sophia_h.py,sha256=He9YrHeaQhiz4CJm-3H_d_M07MGTsP663v8wx4BlaZI,4273
|
|
81
|
-
torchzero/modules/projections/__init__.py,sha256=OCxlh_-Tx-xpl31X03CeFJH9XveH563oEsWc8rUvX0A,196
|
|
82
|
-
torchzero/modules/projections/dct.py,sha256=0tswjgta3mE5D5Yjw9mJWqPBDga0OIe3lKlwd1AXASc,2369
|
|
83
|
-
torchzero/modules/projections/fft.py,sha256=wNDZP5-3b2-bND3qH2yvX3SqFaljbLkPTQ1gUnlH5fU,2955
|
|
84
|
-
torchzero/modules/projections/galore.py,sha256=etaG2gxazxuDEu-e2r7lKIKMTPEGGS5Vi7HXccmD3kY,241
|
|
85
|
-
torchzero/modules/projections/projection.py,sha256=QUV_Gi6QlPiWEmcc7rwucr2yuYwYFGvSRUAT4uucqMY,10049
|
|
86
|
-
torchzero/modules/projections/structural.py,sha256=f8-72zViXJ6S2gxDagkrrul9IaOPsYXZmX8sFLYkxCc,5683
|
|
87
|
-
torchzero/modules/quasi_newton/__init__.py,sha256=Yc-NV__cJCiYLr2BZG4VsYa3VVq4gCxBMcirQEXSNIo,630
|
|
88
|
-
torchzero/modules/quasi_newton/cg.py,sha256=lvmwJNTR7AEcpDIvpcLnMrZrOLwNld8GFAC19CcTKoY,11661
|
|
89
|
-
torchzero/modules/quasi_newton/lbfgs.py,sha256=BDiv3f7qN8-Nhs8LqtWwk7Wwv88NtXXYle5WwKeekm4,9198
|
|
90
|
-
torchzero/modules/quasi_newton/lsr1.py,sha256=A0Pstikb6JrQbwM5RZjLw9WJEHiMRy3PsPF1_iLkrK4,6053
|
|
91
|
-
torchzero/modules/quasi_newton/olbfgs.py,sha256=Tz2eubiN7OXGN1mbXT4VKPd9kynpXzcLas7mrvBax-k,8333
|
|
92
|
-
torchzero/modules/quasi_newton/quasi_newton.py,sha256=4hRII9GFE5MzNtXkHH_T1hEJ1T8T4-Q4A4MXlhf64mc,25142
|
|
93
|
-
torchzero/modules/quasi_newton/experimental/__init__.py,sha256=3qpZGgdsx6wpoafWaNWx-eamRl1FuxVCWQZq8Y7Cl98,39
|
|
94
|
-
torchzero/modules/quasi_newton/experimental/modular_lbfgs.py,sha256=oLbJ96sl-2XBwLbJrrTZiLJIhKhTPOD6-wny7hbSno4,10767
|
|
95
|
-
torchzero/modules/second_order/__init__.py,sha256=jolCGaIVkID9hpxgx0Tc22wgjVlwuWekWjKTMe5jKXw,114
|
|
96
|
-
torchzero/modules/second_order/newton.py,sha256=ZYIcLpifcOHL_KRC6YoNs-MJQKM39urXUQzReWnWeXE,6583
|
|
97
|
-
torchzero/modules/second_order/newton_cg.py,sha256=YAEAD_8YU_H8Y-o6JI0Ywgk-kpAQOFBQm2Bjzaz9Bjs,2865
|
|
98
|
-
torchzero/modules/second_order/nystrom.py,sha256=aM6dlDv7znGYNXZgKN6B6AhZ1Tpp01JMs83B1hcXE3w,6061
|
|
99
|
-
torchzero/modules/smoothing/__init__.py,sha256=tUTGN0A-EQC7xuLV2AuHFWk-t7D6jIJlpV_3qyfRqLk,80
|
|
100
|
-
torchzero/modules/smoothing/gaussian.py,sha256=KbCgRXGntdPbt4-ojalrHkniYgYXk2294b-2C4MIFi8,6109
|
|
101
|
-
torchzero/modules/smoothing/laplacian.py,sha256=Vp2EnCQhyfGc3CbyOLc6_ZiVx_jvnOISf9vlHkIH4Jo,4998
|
|
102
|
-
torchzero/modules/weight_decay/__init__.py,sha256=j2Vq3DDxLYIPJmXWgAJ6dL-rXzcDEZxxvhJqRT3H0-U,95
|
|
103
|
-
torchzero/modules/weight_decay/weight_decay.py,sha256=UFL9W5w5nzTZGWvCwyGLe9UWBKN8FTClme1Klt7XZPw,3034
|
|
104
|
-
torchzero/modules/wrappers/__init__.py,sha256=6b5Ac-8u18IVp_Jnw1T1xQExwpQhpQ0JwNV9GyC_Yj8,31
|
|
105
|
-
torchzero/modules/wrappers/optim_wrapper.py,sha256=-wNI-fN8eaMSkvPIcPa34yxH0St5aLn7jaaLeh2DUsM,3569
|
|
106
|
-
torchzero/optim/__init__.py,sha256=aXf7EkywqYiR50I4QeeVXro9aBhKiqfbY_BCia59sgU,46
|
|
107
|
-
torchzero/optim/utility/__init__.py,sha256=pUacok4XmebfxofE-QWZLgViajsU-3JkXcWi9OS-Jrw,24
|
|
108
|
-
torchzero/optim/utility/split.py,sha256=ZbazNuMTYunm75V_5ard0A_LletGaYAg-Pm2rANJKrE,1610
|
|
109
|
-
torchzero/optim/wrappers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
110
|
-
torchzero/optim/wrappers/directsearch.py,sha256=Y2-7Sy4mYRPXPh0FTlsY_XOk5pCGjZsnbrlWCPZNp6A,10141
|
|
111
|
-
torchzero/optim/wrappers/fcmaes.py,sha256=TQvIktXV8ldy6smBX-S7ZcQEbSmSZyj567TuYShbvJg,3513
|
|
112
|
-
torchzero/optim/wrappers/mads.py,sha256=lC7edtrFS37PgmX7z9-eoqw6prl0k5BDB4NVBVQXJWE,2945
|
|
113
|
-
torchzero/optim/wrappers/nevergrad.py,sha256=qslMb-4_kfjU3Dd0UbbzE2SdLViil3Qjo2v0FtPE3Fg,4000
|
|
114
|
-
torchzero/optim/wrappers/nlopt.py,sha256=AaVEKfjbrt5DFION44_-g-jQAoVi4lCvBBPU5UDGO9Q,8151
|
|
115
|
-
torchzero/optim/wrappers/optuna.py,sha256=YN1I3rzsi20A9963pWNWd7W75FkxalVb5z5fCRQeWA0,2280
|
|
116
|
-
torchzero/optim/wrappers/scipy.py,sha256=pR26v8v0a-o2u0sbsKXpZ9JUKqXMaaI8gGLI8xYx3-s,19239
|
|
117
|
-
torchzero/utils/__init__.py,sha256=7beAjXvnmBQoy5hwYHY_PBUtrrbYb9Z7-KrYgfcFkPE,844
|
|
118
|
-
torchzero/utils/compile.py,sha256=N8AWLv_7oBUHYornmvvx_L4uynjiD-x5Hj1tBwei3-w,5127
|
|
119
|
-
torchzero/utils/derivatives.py,sha256=sAVd0Q1xmIPpo_AxRuoow66Hy_3goX_9o3lQK_1TyW0,16909
|
|
120
|
-
torchzero/utils/numberlist.py,sha256=cbG0UsSb9WCRxVhw8sd7Yf0bDy_gSqtghiJtkUxIO6U,6139
|
|
121
|
-
torchzero/utils/ops.py,sha256=n4Su1sbgTzlHczuPEHkuWenTtNBCa_MvlQ_hCZkIPnQ,314
|
|
122
|
-
torchzero/utils/optimizer.py,sha256=r52qu6pEcRH4lCXVlLxW5IweA6L-VrQj6RCMfdhzRpw,12466
|
|
123
|
-
torchzero/utils/optuna_tools.py,sha256=F-1Xg0n_29MVEb6lqgUFFNIl9BNJ6MOdIJPduoNH4JU,1325
|
|
124
|
-
torchzero/utils/params.py,sha256=nQo270aOURU7rJ_D102y2pSXbzhJPK0Z_ehx4mZBMes,5784
|
|
125
|
-
torchzero/utils/python_tools.py,sha256=T5W7MpR7pNXiWSVw7gj-UuE9Ch0p9LRWuUZfg9Vtb-I,2794
|
|
126
|
-
torchzero/utils/tensorlist.py,sha256=qSbiliVo1euFAksdHHHRbPUdYYxfkw1dvhpXj71wGy0,53162
|
|
127
|
-
torchzero/utils/torch_tools.py,sha256=ohqnnZRlqdfp5PAfMSbQDIEKygW0_ARjxSEBp3Zo9nU,4756
|
|
128
|
-
torchzero/utils/linalg/__init__.py,sha256=Dzbho3_z7JDdKzYD-QdLArg0ZEoC2BVGdlE3JoAnXHQ,272
|
|
129
|
-
torchzero/utils/linalg/benchmark.py,sha256=wiIMn-GY2xxWbHVf8CPbJddUPeUPq9OUDkvbp1iILYI,479
|
|
130
|
-
torchzero/utils/linalg/matrix_funcs.py,sha256=-LecWrPWbJvfeCgIzUhfWARa2aSZvJ12lHX7Jno38O4,3099
|
|
131
|
-
torchzero/utils/linalg/orthogonalize.py,sha256=mDCkET7qgDZqf_y6oPYAK3d2L5HrB8gzOFPl0YoONaY,399
|
|
132
|
-
torchzero/utils/linalg/qr.py,sha256=L-RXuYV-SIHI-Llq4y1rQ_Tz-yamds0_QNZeHapbjNE,2507
|
|
133
|
-
torchzero/utils/linalg/solve.py,sha256=P0PMi0zro3G3Rd0X-JeoLk7tqYDB0js0aB4bpQ0OABU,5235
|
|
134
|
-
torchzero/utils/linalg/svd.py,sha256=wBxl-JSciINV-N6zvM4SGdveqMr6idq51h68LyQQRYg,660
|
|
135
|
-
torchzero-0.3.10.dist-info/licenses/LICENSE,sha256=r9ZciAoZoqKC_FNADE0ORukj1p1XhLXEbegdsAyqhJs,1087
|
|
136
|
-
torchzero-0.3.10.dist-info/METADATA,sha256=_J7AbrIa-nD6UWbuydCwxAnSpKcC9O1Vp_rM896ZkYQ,14081
|
|
137
|
-
torchzero-0.3.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
138
|
-
torchzero-0.3.10.dist-info/top_level.txt,sha256=YDdpIOb7HyKV9THOtOYsFFMTbxvCO0kiol4-83tDj-A,21
|
|
139
|
-
torchzero-0.3.10.dist-info/RECORD,,
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 inikishev
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
File without changes
|