Catalog PyPI
PACKAGE EXPLORERView in registry

afor-optimizer

PyPI

Adaptive Forgetting Optimizer for PyTorch

adaptive-optimizationdeep-learningmachine-learningoptimizerpytorch
Versions collected1
Direct dependencies1From release 0.1.0
Last observed20 Oct, 21:10 UTC

README

Version 0.1.0 documentation

AFOR

AFOR is a tensor-wise adaptive forgetting optimizer for PyTorch. It adapts the second-moment decay coefficient from local gradient residuals, direction consistency, and online Z-score normalization.

Installation

pip install afor-optimizer

Usage

import torch
from AFOR import afor

model = torch.nn.Linear(10, 2)
optimizer = afor(
    model.parameters(),
    lr=1e-3,
    betas=(0.9, 0.999),
    beta2_min=0.99,
    dir_weight=1.0,
    weight_decay=1e-4,
)

inputs = torch.randn(16, 10)
targets = torch.randint(0, 2, (16,))
loss = torch.nn.functional.cross_entropy(model(inputs), targets)
loss.backward()
optimizer.step()
optimizer.zero_grad()

Main Parameters

  • lr: learning rate.
  • betas: first-moment and initial second-moment coefficients.
  • beta2_min: lower bound for the adaptive second-moment coefficient.
  • dir_weight: weight of gradient-direction consistency.
  • eps: numerical stability term.
  • weight_decay: decoupled weight decay.
  • fast_ref: use the larger fast/slow noise estimate as the noise reference.

AFOR currently supports dense gradients only.

License

Released under the MIT License. See LICENSE.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.014 Sept 20261

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:10 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:0f59d0e0999b8f44b1b1bf6f2bf33efd2dad8557628d5b2c2dbbde21fc0783b4