Catalyst logo

PyTorch framework for Deep Learning R&D.

It focuses on reproducibility, rapid experimentation, and codebase reuse so you can create something new rather than write yet another train loop. Break the cycle - use the Catalyst!

Read more about our vision in the Project Manifest. Catalyst is a part of the PyTorch Ecosystem.

Catalyst Ecosystem consists of:
  • Alchemy - experiments logging & visualization

  • Catalyst - accelerated deep learning R&D

  • Reaction - convenient deep learning models serving

Catalyst at AI Landscape.

Getting started

import os
from torch import nn, optim
from import DataLoader
from catalyst import dl, utils
from import ToTensor
from catalyst.contrib.datasets import MNIST

model = nn.Sequential(nn.Flatten(), nn.Linear(28 * 28, 10))
criterion = nn.CrossEntropyLoss()
optimizer = optim.Adam(model.parameters(), lr=0.02)

loaders = {
    "train": DataLoader(
        MNIST(os.getcwd(), train=True, download=True, transform=ToTensor()), batch_size=32
    "valid": DataLoader(
        MNIST(os.getcwd(), train=False, download=True, transform=ToTensor()), batch_size=32

runner = dl.SupervisedRunner(
    input_key="features", output_key="logits", target_key="targets", loss_key="loss"

# model training
        dl.AccuracyCallback(input_key="logits", target_key="targets", topk_args=(1, 3, 5)),
            input_key="logits", target_key="targets", num_classes=10

# model evaluation
metrics = runner.evaluate_loader(
    callbacks=[dl.AccuracyCallback(input_key="logits", target_key="targets", topk_args=(1, 3, 5))],
assert "accuracy" in metrics.keys()

# model inference
for prediction in runner.predict_loader(loader=loaders["valid"]):
    assert prediction["logits"].detach().cpu().numpy().shape[-1] == 10

features_batch = next(iter(loaders["valid"]))[0]
# model stochastic weight averaging
model.load_state_dict(utils.get_averaged_weights_by_path_mask(logdir="./logs", path_mask="*.pth"))
# model tracing
utils.trace_model(model=runner.model, batch=features_batch)
# model quantization
# model pruning
utils.prune_model(model=runner.model, pruning_fn="l1_unstructured", amount=0.8)
# onnx export
utils.onnx_export(model=runner.model, batch=features_batch, file="./logs/mnist.onnx", verbose=True)

Step by step guide

  1. Start with Catalyst 2021–Accelerated PyTorch 2.0 introduction.

  2. Check minimal examples.

  3. Try notebook tutorials with Google Colab.

  4. Read blogposts with use-cases and guides.

  5. Learn machine learning with our “Deep Learning with Catalyst” course.

  6. If you would like to contribute to the project, follow our contribution guidelines.

  7. If you want to support the project, feel free to donate on patreon page or write us with your proposals.

  8. And do not forget to join our slack for collaboration.


Catalyst helps you write compact but full-featured Deep Learning pipelines in a few lines of code. You get a training loop with metrics, early-stopping, model checkpointing and other features without the boilerplate.


Common installation:

pip install -U catalyst

More specific with additional requirements:

pip install catalyst[ml]         # installs ML-based Catalyst
pip install catalyst[cv]         # installs CV-based Catalyst
# master version installation
pip install git+ --upgrade

Catalyst is compatible with: Python 3.6+. PyTorch 1.3+.

Tested on Ubuntu 16.04/18.04/20.04, macOS 10.15, Windows 10 and Windows Subsystem for Linux.


  • Universal train/inference loop.

  • Configuration files for model/data hyperparameters.

  • Reproducibility – all source code and environment variables will be saved.

  • Callbacks – reusable train/inference pipeline parts with easy customization.

  • Training stages support.

  • Deep Learning best practices - SWA, AdamW, Ranger optimizer, OneCycle, and more.

  • Developments best practices - fp16 support, distributed training, slurm support.


All Catalyst code, features and pipelines are fully tested with our own catalyst-codestyle.

In fact, we train a number of different models for various of tasks - image classification, image segmentation, text classification, GANs training and much more. During the tests, we compare their convergence metrics in order to verify the correctness of the training procedure and its reproducibility.

As a result, Catalyst provides fully tested and reproducible best practices for your deep learning research.

Indices and tables