kozistr/pytorch_optimizer

optimizer & lr scheduler & loss function collections in PyTorch

What it solves

This toolkit eliminates the need to manually implement or hunt down various optimization algorithms for PyTorch. It provides a centralized, consistent library for researchers and developers who want to experiment with modern training methods—such as new optimizers, learning rate schedulers, and loss functions—without the overhead of writing boilerplate code for each one.

How it works

It offers a unified API that allows you to load and use over 100 different optimizers, 10+ schedulers, and 10+ loss functions. You can instantiate these components directly by class name, load them by string name, or use a builder function. The library also supports advanced features like automatic compilation for fused optimizer updates and integrates with ecosystem tools like bitsandbytes and torchao.

Who it’s for

This is designed for machine learning researchers and engineers who need to perform fast, iterative experimentation with diverse training techniques and want a reliable, maintained collection of state-of-the-art optimization algorithms.

Highlights

  • Broad coverage of 100+ optimizers, including recent research variants.
  • Consistent API for loading optimizers, schedulers, and loss functions.
  • Built-in support for practical training techniques like Lookahead and Gradient Centralization.
  • Optional performance optimizations via PyTorch compilation.
  • Compatible with popular ecosystem libraries like bitsandbytes and torchao.

Related

  • Project
  • Project
  • Project
  • Project
  • Project