Library / SDK
timeseriesAI/tsai avatar
timeseriesAI/tsai

tsai: Deep Learning for Time Series on PyTorch and fastai

Time series Timeseries Deep Learning Machine Learning Python Pytorch fastai | State-of-the-art Deep Learning library for Time Series and Sequences in Pytorch / fastai

6,120 stars722 forksJupyter NotebookApache-2.0

At a glance

What is it?
tsai bundles dozens of published time series architectures behind the fastai Learner API. It is a strong fit for classification and regression on fixed-length windows, and a weaker fit for online or streaming forecasting.
Who is it for?
Adopt tsai if you already work in PyTorch or fastai and your problem is fixed-length window classification or regression, where InceptionTime, TCN or MiniRocket can be trained with a few lines of Learner code. Skip it if you need online inference over an unbounded stream, or if you want a gradient boosting baseline first; sktime and tsfresh cover that ground with a scikit-learn style API, and tsai only pulls them in as optional extras.
Can I use it commercially?
Yes. Apache-2.0 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 69 days ago.
What is it written in?
Mainly Jupyter Notebook, according to GitHub's language statistics.

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

Editorial analysis

The gap tsai fills between raw PyTorch and a working time series experiment

Writing a time series classifier from scratch in PyTorch means writing a Dataset, a collate function, a training loop, a learning rate schedule and an evaluation harness before you learn anything about your data. tsai removes that scaffolding by building on fastai, so a model, a dataloader and a Learner replace the boilerplate. The README describes it as a "State-of-the-art Deep Learning library for Time Series and Sequences" built on top of Pytorch and fastai, focused on classification, regression, forecasting and imputation. The intended user is someone who already knows Python and is comfortable with the fastai Learner abstraction, not someone looking for a point-and-click tool. The repository is mostly Jupyter notebooks, which matters: the library is developed notebook-first with nbdev, and the README carries an autogenerated warning at the top saying the file should not be edited by hand. The last push was on 2026-07-23, and the release history shows v1.0.1 on 2026-05-27, so the project is still moving, but the conda channel is not.

How tsai is put together: nbdev notebooks, fastai Learner, and a model zoo

The mechanism is worth understanding before you install, because it explains both the convenience and the debugging experience. Source lives in nbs/ as notebooks, and nbdev exports them into the tsai/ package directory. The pyproject.toml registers an nbdev entry point pointing at tsai._modidx, and a console script nb2py mapped to tsai.export:nb2py, which is the notebook-to-Python path. On top of that sits fastai: tsai models are torch modules that plug into fastai's Learner, so training, callbacks, learning rate finding and metrics come from fastai rather than from tsai itself. The README lists the available architectures with paper citations, including LSTM, GRU, MLP, FCN, ResNet, LSTM-FCN, GRU-FCN, mWDN, TCN, MLSTM-FCN, InceptionTime, Rocket, XceptionTime, ResCNN, TabModel, OmniScale, TST, TabTransformer, TSiT, MiniRocket, XCM, gMLP and TSPerceiver. That list is the real product. Most of these are reimplementations of published papers, so the value is in having them behind one consistent API rather than in any single architecture. The README also notes PatchTST, RNNAttention, LSTMAttention, GRUAttention and TabFusionTransformer as recent additions, plus 128 univariate classification datasets, 30 multivariate classification datasets, 15 regression datasets, 62 forecasting datasets and 9 long term forecasting datasets available for download.

Installing tsai with pip and training a first InceptionTime model

The README requires Python 3.10 or newer; support for Python 3.9 was dropped in tsai 1.0.0. The stable release comes from PyPI.

bash
pip install tsai

For an editable install against the repository, the README gives this pair of commands, which clones into a directory named tsai and installs the dev extra.

bash
git clone https://github.com/timeseriesAI/tsai
pip install -e "tsai[dev]"

Only hard dependencies are installed by default. Optional dependencies (sktime, tsfresh, PyWavelets, nbformat) are needed for selected tasks, and the README states that tsai will prompt you to install them when required. To get them all at once, use the extras extra.

bash
pip install tsai[extras]

Conda is no longer a supported install path. As of tsai 1.0.0 the conda channel is no longer updated, and the README directs new installs to pip, noting that older releases remain on the timeseriesai conda channel. There is also a docker-compose.yml in the repository for a notebook workflow. It defines a notebook service based on the fastai/codespaces image that runs pip install -e . and then jupyter notebook on port 8080, with a watcher service and a jekyll service on port 4000 for the documentation site. That file is aimed at developing tsai itself, not at using it as a library, and it disables the notebook token and password, so treat it as a local development convenience rather than a deployment recipe. A first real use is to pick a dataset, build a dataloader and hand it to a Learner. The README does not spell out a complete training script, so the exact dataloader constructor arguments are something to confirm against the documentation site and the tutorial notebooks before you rely on them.

Where tsai gets in the way: version pinning, optional dependencies and notebook-shaped source

The dependency constraints in pyproject.toml are tight in both directions. scikit-learn is pinned to >=1.7,<1.8, and torch to >=2.12,<3. If your environment already holds a different scikit-learn minor version, installing tsai will move it, and anything else in that environment depending on the old pin comes along for the ride. fastai>=2.8.7 and fastcore>=1.13.2 are the floor, so an older fastai install will be upgraded. The optional extras are a second trap: sktime, tsfresh, PyWavelets and nbformat are not installed by default, and the failure mode is a prompt at runtime rather than an error at install time, which is easy to miss in a batch job. The notebook-first layout is a third consideration. If you want to read the implementation of a model, you are reading nbs/ notebooks or the exported files under tsai/, and the README explicitly warns that the README itself is autogenerated, which signals that the documentation site is generated from the same notebook sources. For a library whose selling point is a large model zoo, the practical risk is not that a model is missing but that a given architecture's constructor arguments are documented in a tutorial notebook rather than in a stable API reference. The README lists the models; it does not document their signatures.

When tsai is the wrong tool

tsai is a deep learning library, so it inherits the data appetite of one. On a few hundred labelled windows with a handful of channels, a gradient boosted tree on summary statistics will often be competitive and far cheaper to iterate on, and the README does not present tsai as a small-data tool. The Rocket and MiniRocket entries are the closest thing to a cheap baseline in the model list, since those are kernel methods rather than trained deep networks, but they still arrive through the same Learner machinery. Streaming is the clearer boundary. The library is built around fixed-length windows passed through a fastai dataloader, and the README's forecasting material is framed around forecast datasets and long term forecasting, not around online updates as new observations arrive. If your requirement is a model that ingests one point at a time and revises its output continuously, tsai's data pipeline is the wrong shape. Finally, if you need probabilistic forecasts with calibrated intervals, the README does not advertise that as a supported output, and nothing in the listed model names suggests a built-in probabilistic head. Treat that as unverified rather than as a feature.

sktime and tsfresh as the classical alternative

The honest alternative for a scikit-learn user is sktime, with tsfresh for feature extraction. The difference in approach is not cosmetic. sktime wraps time series estimators in a scikit-learn compatible interface, so fit, predict and Pipeline behave the way the rest of your stack does, and you can grid search over them with the tools you already have. tsai instead routes everything through fastai's Learner, which brings callbacks, discriminative learning rates and a training loop designed for neural networks. That is a real gain when you are training a TCN or a transformer, and it is overhead when you want to compare a random forest against an ExtraTrees classifier. tsai acknowledges the split by listing sktime and tsfresh as optional extras rather than dependencies, so the two worlds can coexist in one environment, but you install them deliberately. A reasonable sequence is to establish a sktime or tsfresh baseline first, then move to tsai when the baseline plateaus and you have enough labelled windows to justify a deep model.

Licence, maintenance and what an upgrade costs

tsai is Apache-2.0, declared in both the LICENSE file and the [project] table in pyproject.toml. That is a permissive licence with an explicit patent grant, and it does not impose copyleft obligations on your code, but the usual caveat applies: this is a description of what the repository declares, not legal advice, and if you are embedding the library in a product you should read the licence text yourself. Maintenance signals are mixed in a specific way. The repository is not archived and the last push was on 2026-07-23. The release cadence shows 0.4.1 on 2025-07-29, then v1.0.0 on 2026-05-26 and v1.0.1 on 2026-05-27, so a long gap was followed by a major version bump and a patch a day later. The README points to the CHANGELOG for full upgrade notes for anyone coming from 0.x, and the Python floor moved to 3.10 in 1.0.0. The upgrade cost that matters most is environmental rather than API-level: the pinned scikit-learn range and the torch floor mean a tsai upgrade can force upgrades elsewhere. The conda channel being frozen compounds this, since conda users have to migrate to pip to stay current.

Editorial conclusion

Adopt tsai if you already work in PyTorch or fastai and your problem is fixed-length window classification or regression, where InceptionTime, TCN or MiniRocket can be trained with a few lines of Learner code. Skip it if you need online inference over an unbounded stream, or if you want a gradient boosting baseline first; sktime and tsfresh cover that ground with a scikit-learn style API, and tsai only pulls them in as optional extras. Before committing, check that your Python is 3.10 or newer, that torch resolves inside the >=2.12,<3 range declared in pyproject.toml, and that the model you want is actually listed in the README's model section rather than only in the notebooks.

Frequently asked questions

Can PyTorch be used for time series forecasting?

Yes. tsai is built on PyTorch and fastai and the README lists forecasting among its target tasks, alongside classification, regression and imputation. It ships with 62 forecasting datasets and 9 long term forecasting datasets available for download.

What is the best model for time series forecasting in tsai?

The README does not name a best model. It lists the available architectures, including InceptionTime, TCN, TST, PatchTST, Rocket and MiniRocket, with paper citations, and leaves the choice to the task. The repository includes tutorial notebooks for specific models such as PatchTST.

Is time series a machine learning model?

Time series is a data type, not a model. tsai treats it as a data type and supplies models for it, covering classification, regression, forecasting and imputation as separate tasks.

Official sources

  1. License: Apache-2.0
  2. Project website
  3. README
  4. Releases
  5. timeseriesAI/tsai 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/timeseriesai-tsai.svg)](https://hysenlabs.com/projects/timeseriesai-tsai)