pytorch-forecasting
Forecasting timeseries with PyTorch - dataloaders, normalizers, metrics and models
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-forecastinguv
uv add pytorch-forecastingpoetry
poetry add pytorch-forecastingInstalling 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
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
neuralforecastNeuralForecast provides a collection of neural…
permissive · top 15,000 on PyPI
gluontsGluonTS provides deep learning models for…
permissive · top 5,000 on PyPI
dartsDarts provides forecasting and anomaly…
permissive · top 15,000 on PyPI
neuralprophetNeuralProphet is a PyTorch-based framework for…
permissive · top 15,000 on PyPI
torchsrProvides pretrained neural network models for…
permissive · top 15,000 on PyPI
pytorch-ignitePyTorch Ignite provides a high-level training…
permissive · top 15,000 on PyPI
lightningLightning is a framework that organizes PyTorch…
permissive · top 5,000 on PyPI
u8dartsu8darts is a deprecated compatibility shim that…
permissive · top 15,000 on PyPI
chronos-forecastingChronos provides pretrained transformer-based…
permissive · top 15,000 on PyPI
tbatsImplements BATS and TBATS exponential smoothing…
permissive · top 15,000 on PyPI