Open-source project
sktime/pytorch-forecasting avatar
sktime/pytorch-forecasting

PyTorch Forecasting: state-of-the-art forecasting behind one TimeSeriesDataSet

Time series forecasting with PyTorch

4,998 stars913 forksPythonMIT

At a glance

What is it?
PyTorch Forecasting is sktime's MIT-licensed package for time series forecasting with state-of-the-art deep learning architectures, providing a high-level API over PyTorch Lightning with a dataset class handling transformations, missing values and subsampling, models from Temporal Fusion Transformer and N-BEATS to PatchTST and DeepAR, multi-horizon metrics and optuna-based hyperparameter tuning, at version 1.8.0.
Who is it for?
Use PyTorch Forecasting when forecasting needs deep learning architectures with real-world conveniences, covariates, multiple related series, interpretation and probabilistic outputs, and when training should scale from CPU to multi-GPU without code changes through Lightning. Use classical statistical models when data is small or interpretability through coefficients matters.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 2 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 28, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The two audiences in one API

PyTorch Forecasting is a PyTorch-based package for forecasting with state-of-the-art deep learning architectures, and its stated goal balances two audiences, a high-level API with maximum flexibility for professionals and reasonable defaults for beginners. The package provides the pieces that make that balance real, a timeseries dataset class abstracting variable transformations, missing values, randomized subsampling and multiple history lengths, a base model class providing basic training with TensorBoard logging and generic visualizations such as actual versus predictions and dependency plots, multiple network architectures enhanced for real-world deployment with in-built interpretation capabilities, multi-horizon timeseries metrics, and hyperparameter tuning with optuna. Training scales on GPU or CPU through PyTorch Lightning with automatic logging, so the research prototype and the production job differ in configuration rather than in code. The Towards Data Science article the README links introduces the package with background on why the dataset abstraction exists, worth reading before the API, since the design decisions make more sense once the failure modes of hand-rolled forecasting pipelines are clear.

Installation, with the Windows detour

Installation has one platform-specific branch, on Windows PyTorch comes first with the stable wheel index, `pip install torch -f https://download.pytorch.org/whl/torch_stable.html`, and otherwise a single command covers it:

code
pip install pytorch-forecasting

The conda route splits the channels explicitly:

code
conda install pytorch-forecasting pytorch -c pytorch>=1.7 -c conda-forge

with the package installing from conda-forge while PyTorch comes from the pytorch channel. One capability has its own extra, the MQF2 multivariate quantile loss requiring pip install pytorch-forecasting[mqf2]. The dependency pins in the metadata show the maintenance discipline, torch capped below 3.0, lightning below 2.7 with two specific buggy versions excluded, and pandas, scikit-learn and scipy bounded on both sides, with Python 3.10 through 3.14 supported.

The model catalog, with its benchmarks

The available models list is a short course in modern forecasting. Temporal Fusion Transformer for interpretable multi-horizon forecasting, cited as outperforming DeepAR by Amazon by 36 to 69 percent in benchmarks. N-BEATS, neural basis expansion analysis, which as an ensemble outperformed all other methods including ensembles of traditional statistical methods in the M4 competition, described as arguably the most important benchmark for univariate forecasting. N-HiTS, which supports covariates, has consistently beaten N-BEATS, and suits long-horizon forecasting particularly well. DeepAR, probabilistic forecasting with autoregressive recurrent networks, one of the most popular algorithms and often used as a baseline. PatchTST achieving state-of-the-art long-term performance with Transformers using channel independence and patching. Simple baselines complete the set, LSTM and GRU networks, an MLP decoder, and a model that always predicts the latest known value. The benchmark claims attached to each model are the papers' claims, reproduced here as the documentation presents them, and the comparison page orders the models by their practical tradeoffs rather than their publication dates, which is the useful sorting for a practitioner choosing where to start.

TimeSeriesDataSet: where the data work goes

The usage example's imports announce the workflow, lightning for training with the TensorBoard logger and the EarlyStopping and LearningRateMonitor callbacks, and from pytorch_forecasting the TimeSeriesDataSet, the TemporalFusionTransformer and the QuantileLoss. The comment on the data frame spells the contract, at least a column for the target to predict, a timeseries ID as a unique string identifying each series, and the time of the observations, the three columns everything else derives from. The dataset class converts pandas dataframes into the training tensors, handling the transformations, missing values and sampling described in the feature list, so the data preparation that dominates real forecasting projects is configured through the dataset's parameters rather than hand-written pipelines.

Lightning underneath, optuna above

The package is built on PyTorch Lightning to allow training on CPUs, single and multiple GPUs out-of-the-box, the scaling story that determines whether a model reaches production. Logging lands in TensorBoard through Lightning's machinery, and the base model class adds the visualizations, actual versus predictions and dependency plots, that interpretation requires. On the other side, hyperparameter tuning with optuna is a first-class capability, the tuning extra carrying the dependencies, so the search over the architectures' many hyperparameters is scripted rather than manual. The examples directory shows the shapes this takes in practice, ar, nbeats, a nbeats variant with KAN layers, and the stallion example, the package's canonical beer production demo dataset. The Tuner import visible in the usage example belongs to Lightning rather than the package itself, so learning rate finding and other pretraining tuning flows through the same trainer machinery as the training loop, one fewer API to learn.

Governance under sktime

The repository lives under the sktime organization, the umbrella project for time series machine learning in Python, with governance and code of conduct files at the root, a codeowners file assigning review responsibility, and an extension_templates directory for contributors adding models or components. The new models tutorial covers basic and advanced architectures, the documented path for anyone implementing a custom network, and the package description, forecasting timeseries with PyTorch, dataloaders, normalizers, metrics and models, enumerates the layers the templates extend. Author Jan Beitner is named in the metadata, and the community surface spans a Discord, a LinkedIn presence and the gc-os-ai site linked from the badge table, with releases on a steady quarterly-ish cadence, v1.6.1 in January 2026, v1.7.0 in April and v1.8.0 on 2026-06-24. Continuous integration publishes to PyPI through a dedicated release workflow, and the code coverage badge tracks the main branch, the pair of signals that a library with this many models keeps its test surface honest as contributors add architectures.

Editorial conclusion

Use PyTorch Forecasting when forecasting needs deep learning architectures with real-world conveniences, covariates, multiple related series, interpretation and probabilistic outputs, and when training should scale from CPU to multi-GPU without code changes through Lightning. Use classical statistical models when data is small or interpretability through coefficients matters. Before adopting, install PyTorch first on Windows from the stable wheel index, add the mqf2 extra for the multivariate quantile loss, check the documented model comparison rather than picking by name recognition, and read the assumptions of Temporal Fusion Transformer benchmarks, the package's own numbers being from the models' papers rather than your data.

Frequently asked questions

what is pytorch forecasting?

PyTorch Forecasting is an MIT-licensed package for time series forecasting with state-of-the-art deep learning architectures, providing a high-level API over PyTorch Lightning. It includes a TimeSeriesDataSet class handling transformations and missing values, models like Temporal Fusion Transformer, N-BEATS, N-HiTS, DeepAR and PatchTST, multi-horizon metrics, and optuna hyperparameter tuning.

how to install pytorch forecasting?

On Windows, install PyTorch first with pip install torch from the pytorch stable wheel index, then run pip install pytorch-forecasting. On other platforms the single pip install suffices, conda installation combines the conda-forge and pytorch channels, and the mqf2 extra adds the multivariate quantile loss.

Which models does PyTorch Forecasting include?

Temporal Fusion Transformer, N-BEATS, N-HiTS, DeepAR and PatchTST, plus simple standard networks for baselining, LSTM and GRU networks, an MLP on the decoder, and a baseline that always predicts the latest known value. The documentation provides a comparison of the available models.

Official sources

  1. License: MIT
  2. Project website
  3. README
  4. Releases
  5. sktime/pytorch-forecasting on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/sktime-pytorch-forecasting.svg)](https://hysenlabs.com/projects/sktime-pytorch-forecasting)