skillfed

pytorch-forecasting

Forecasting timeseries with PyTorch - dataloaders, normalizers, metrics and models

pytorch-forecasting v1.8.0 344.3K downloads/30d#7,375 on PyPI
Permissive license Active released

What it is and what it does

PyTorch Forecasting is a high-level library for building and training deep learning time series forecasting models. It abstracts away boilerplate around data handling (variable transformations, missing values, subsampling), model training, and evaluation, while providing several state-of-the-art neural architectures out of the box. The library leverages lightning to handle training on CPUs and GPUs transparently, with automatic logging and visualization.

You use it by converting your pandas DataFrame into a TimeSeriesDataSet, choosing a model architecture (Temporal Fusion Transformer, N-BEATS, N-HiTS, DeepAR, or simpler baselines like LSTM), and training via the Lightning Trainer. It includes multi-horizon metrics, interpretation capabilities, and optional hyperparameter tuning. The package targets both practitioners seeking reasonable defaults and researchers needing flexibility to implement custom architectures.

Use it for:

  • Train a Temporal Fusion Transformer on multivariate time series data with both static and time-varying covariates for interpretable multi-step forecasting.
  • Benchmark multiple architectures (N-BEATS, N-HiTS, DeepAR, LSTM) on your dataset to compare forecasting accuracy without reimplementing each model.
  • Automatically scale training across multiple GPUs using lightning without modifying model code.
  • Build a probabilistic forecasting pipeline with DeepAR to generate prediction intervals alongside point forecasts.
  • Perform hyperparameter tuning with optuna integration to optimize model performance on your specific time series problem.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

PyTorch Forecasting provides neural network models and utilities for time series forecasting, including architectures like Temporal Fusion Transformers, N-BEATS, and N-HiTS, with training orchestrated through PyTorch Lightning.

Yes. The package is actively maintained, has low install friction, carries no known vulnerabilities, and provides a well-structured abstraction over multiple state-of-the-art forecasting architectures. Install it if you need to train neural forecasting models on time series data and want to avoid reimplementing standard architectures or training boilerplate. The MIT license poses no restrictions.

Install

pytorch-forecasting on PyPI

pip

pip install pytorch-forecasting

uv

uv add pytorch-forecasting

poetry

poetry add pytorch-forecasting

Installing pytorch-forecasting

Before you install

Low friction installation as a pure Python wheel. Depends on torch, lightning, and standard scientific stack (numpy, scipy, pandas, scikit-learn, scikit-base). Last release 51 days ago with active maintenance status.

License in practice

MIT license (permissive) allows commercial and private use with minimal restrictions.

Quickstart

pip install pytorch-forecasting

from pytorch_forecasting import TimeSeriesDataSet, TemporalFusionTransformer
import lightning.pytorch as pl

training = TimeSeriesDataSet(
    data,
    time_idx="time_column",
    target="target_column",
    group_ids=["series_id"],
    max_encoder_length=36,
    max_prediction_length=6
)

model = TemporalFusionTransformer.from_dataset(training)
trainer = pl.Trainer(max_epochs=10)
trainer.fit(model, train_dataloaders=training.to_dataloader(train=True))

Requires torch to be installed; on Windows, install torch separately via pip install torch -f https://download.pytorch.org/whl/torch_stable.html before installing pytorch-forecasting.

Verify before relying

  • Whether the package's GPU/multi-GPU training scales efficiently in production environments
  • Performance characteristics and memory requirements for large-scale time series datasets
  • Availability and completeness of hyperparameter tuning integration with optuna

Package facts

License not declared (permissive)
Python support supports the current Python release (<3.15,>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 7 — numpy, torch, lightning, scipy, pandas, scikit-learn, scikit-base
Maintenance actively maintained — 51 days since the last release
First released
Downloads 344,304/month — #7,375 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pytorch_forecasting-1.8.0-py3-none-any.whl

Intended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Scientific/Engineering :: MathematicsTopic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules

Tags

time series forecasting neural networkspytorch deep learning forecastingtemporal fusion transformern-beats forecastingmultivariate time series predictionlstm gru forecastingautoregressive forecasting models
time-series-forecastingdeep-learningpytorch-lightning

More Software Development packages