Skip to main content

Stochastic Polyak Step-sizes and Momentum: Convergence Guarantees and Practical Performance

Project description

MomSPS

This is the official repository for the code used to run the experiments in the paper that proposed the MomSPS optimizer. The optimizer is implemented in PyTorch.

Stochastic Polyak Step-sizes and Momentum: Convergence Guarantees and Practical Performance
D. Oikonomou, N. Loizou

Installation

You can install the package with

pip install momsps

Usage

Import the optimizers in Python with

from momsps import MomSPS
opt = MomSPS(model.parameters(), lr=1)

or

from momsps import MomSPS_smooth
opt = MomSPS_smooth(model.parameters(), lr=1)

Important: you only need to adapt one line of your training script, described below. MomSPS needs access to the value of the (mini-batch) loss in the .step() method. The easiest way to do this is

loss = YOUR_LOSS_FUNCTION()
loss.backward()
opt.step(loss=loss)           # the line you need to change

Citation

If you use MomSPS, please cite

@article{Oikonomou2024,
  author        = {Dimitris Oikonomou and Nicolas Loizou},
  title         = {Stochastic Polyak Step-sizes and Momentum: Convergence Guarantees and Practical Performance},
  year          = {2024},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

MomSPS-1.0.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

MomSPS-1.0.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file MomSPS-1.0.0.tar.gz.

File metadata

  • Download URL: MomSPS-1.0.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for MomSPS-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1f17c379ce3079c3897d0dd4f64469649be84bac0b81a2e3fd393319a1b452f3
MD5 aecf3c854c17d1633f8fd7ab50aee8ff
BLAKE2b-256 00d304e9dc0d0ba9ec2bcb9a062fa058a11a16fa2f5f5535f4a9fafd16ada7f9

See more details on using hashes here.

File details

Details for the file MomSPS-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: MomSPS-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for MomSPS-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7780f3ef35fd4a1f02f8d3d19ae23d07de2837538588b9bbebce054b2377016
MD5 71084d9162ebfcd045f41f36e5e46e76
BLAKE2b-256 1654ad2bc5d6a34afef8bbcdcd5fcd077e6a1b76d5b9d833790ff4954b142a76

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page