Official code, datasets and checkpoints for "Timer: Generative Pre-trained Transformers Are Large Time Series Models" (ICML 2024) and subsequent works
1,013
stars
104
commits
Python
primary language
Mar 22, 2026
updated
This repo provides official code, datasets, and checkpoints for Timer: Generative Pre-trained Transformers Are Large Time Series Models. [Poster] [Slides] and our subsequent works [Tutorial (CN)], [Tutorial (EN)].
:triangular_flag_on_post: News (2025.5) Sundial, a family of generative time series foundation models has been accepted as ICML 2025 Oral (Top 1%). Get your zero-shot probabilistic predictions within milliseconds! [HuggingFace] [Quickstart].
:triangular_flag_on_post: News (2025.2) We release an open codebase OpenLTM, which contains the whole pipeline to pre-train and fine-tune large time-series models.
:triangular_flag_on_post: News (2024.12) Timer-XL for unified forecasting is accepted as ICLR 2025. We released a pre-trained model for zero-shot forecasting [HuggingFace] [Quickstart] [Checkpoint].
:triangular_flag_on_post: News (2024.10) We release the pre-training dataset UTSD on HuggingFace or you can use the numpy format UTSD and this dataloader.
:triangular_flag_on_post: News (2024.5) Accepted by ICML 2024, a camera-ready version of 31 pages.
:triangular_flag_on_post: News (2024.2) Releasing model checkpoints and code for fine-tuning on different tasks [README].
Time Series Transformer (Timer) is a pre-trained Transformer for general time series analysis.
We provide out-of-the-box models for zero-shot forecasting (no training and no GPU needed).
Example of Timer (Zero-Shot Forecasting)
import torch
from transformers import AutoModelForCausalLM
# load pretrain model
model = AutoModelForCausalLM.from_pretrained('thuml/timer-base-84m', trust_remote_code=True)
# prepare input
batch_size, lookback_length = 1, 2880
seqs = torch.randn(batch_size, lookback_length)
# generate forecast
prediction_length = 96
normed_output = model.generate(normed_seqs, max_new_tokens=prediction_length)
print(output.shape)
Example of Sundial (Generative Forecasting)
import torch
from transformers import AutoModelForCausalLM
# load pretrain model
# supports different lookback/forecast lengths
model = AutoModelForCausalLM.from_pretrained('thuml/sundial-base-128m', trust_remote_code=True)
# prepare input
batch_size, lookback_length = 1, 2880
seqs = torch.randn(batch_size, lookback_length)
# Note that Sundial can generate multiple probable predictions
forecast_length = 96
num_samples = 20
output = model.generate(seqs, max_new_tokens=forecast_length, num_samples=num_samples)
# use raw predictions for mean/quantiles/confidence-interval estimation
print(output.shape)
More usage examples are provided here. See our HuggingFace for more information.
For developers interested in fine-tuning large time-series models or pre-training on customized datasets, please use OpenLTM, including code scripts and checkpoint of various models.
For developers interested in applying large time-series models on other time series analysis tasks (e.g., imputation and anomaly detection), this repo contains scripts and checkpoints [README].
We collect Unified Time Series Datasets (UTSD), which encompass well-curated time series to facilitate the research on large time-series models. Our dataset is released in HuggingFace.
You can access the data from HuggingFace and load the data in the style of TSLib:
# huggingface-cli login
# export HF_ENDPOINT=https://hf-mirror.com
python ./scripts/UTSD/download_dataset.py
# dataloader
python ./scripts/UTSD/utsdataset.py
We provide code for evaluating time series datasets, which you can use to evaluate your Huggingface formatted dataset:
python ./scripts/UTSD/dataset_evaluation.py --root_path <dataset root path> --log_path <output log path>
If you meet troubles when accessing the data, you can also download UTSD in numpy from [Tsinghua Cloud] and use UTSD_Npy dataloader [here].
We propose Timer, a decoder-only pre-trained time series Transformer. We propose single-series sequence (S3) format, converting diverse series into unified 1D sequences. The predictive model can also be adapted for forecasting, imputation, and anomaly detection [README].
We proposed Timer-XL for unified time series forecasting. It can be used for supervised training or large-scale pre-training, explicitly modeling multi-dimensional time series [GitHub].
We proposed Sundial, a family of generative time series foundation models, which is pre-trained on a trillion (10^12) time points. The model can be applied for both point and probabilistic forecasting, making zero-shot forecasting within milliseconds [GitHub].
If you find this repo helpful, please cite our paper.
@inproceedings{liutimer,
title={Timer: Generative Pre-trained Transformers Are Large Time Series Models},
author={Liu, Yong and Zhang, Haoran and Li, Chenyu and Huang, Xiangdong and Wang, Jianmin and Long, Mingsheng},
booktitle={Forty-first International Conference on Machine Learning}
}
@article{liu2024timer,
title={Timer-XL: Long-Context Transformers for Unified Time Series Forecasting},
author={Liu, Yong and Qin, Guo and Huang, Xiangdong and Wang, Jianmin and Long, Mingsheng},
journal={arXiv preprint arXiv:2410.04803},
year={2024}
}
@article{liu2025sundial,
title={Sundial: A Family of Highly Capable Time Series Foundation Models},
author={Liu, Yong and Qin, Guo and Shi, Zhiyuan and Chen, Zhi and Yang, Caiyin and Huang, Xiangdong and Wang, Jianmin and Long, Mingsheng},
journal={arXiv preprint arXiv:2502.00816},
year={2025}
}
We appreciate the following GitHub repos a lot for their valuable code and datasets:
If you have any questions or want to use the code, feel free to contact:
96 commits
8 commits
Python
93.3%
Shell
6.7%
Official code, datasets and checkpoints for "Timer: Generative Pre-trained Transformers Are Large Time Series Models" (ICML 2024) and subsequent works
1,013
stars
104
commits
Python
primary language
Mar 22, 2026
updated
This repo provides official code, datasets, and checkpoints for Timer: Generative Pre-trained Transformers Are Large Time Series Models. [Poster] [Slides] and our subsequent works [Tutorial (CN)], [Tutorial (EN)].
:triangular_flag_on_post: News (2025.5) Sundial, a family of generative time series foundation models has been accepted as ICML 2025 Oral (Top 1%). Get your zero-shot probabilistic predictions within milliseconds! [HuggingFace] [Quickstart].
:triangular_flag_on_post: News (2025.2) We release an open codebase OpenLTM, which contains the whole pipeline to pre-train and fine-tune large time-series models.
:triangular_flag_on_post: News (2024.12) Timer-XL for unified forecasting is accepted as ICLR 2025. We released a pre-trained model for zero-shot forecasting [HuggingFace] [Quickstart] [Checkpoint].
:triangular_flag_on_post: News (2024.10) We release the pre-training dataset UTSD on HuggingFace or you can use the numpy format UTSD and this dataloader.
:triangular_flag_on_post: News (2024.5) Accepted by ICML 2024, a camera-ready version of 31 pages.
:triangular_flag_on_post: News (2024.2) Releasing model checkpoints and code for fine-tuning on different tasks [README].
Time Series Transformer (Timer) is a pre-trained Transformer for general time series analysis.
We provide out-of-the-box models for zero-shot forecasting (no training and no GPU needed).
Example of Timer (Zero-Shot Forecasting)
import torch
from transformers import AutoModelForCausalLM
# load pretrain model
model = AutoModelForCausalLM.from_pretrained('thuml/timer-base-84m', trust_remote_code=True)
# prepare input
batch_size, lookback_length = 1, 2880
seqs = torch.randn(batch_size, lookback_length)
# generate forecast
prediction_length = 96
normed_output = model.generate(normed_seqs, max_new_tokens=prediction_length)
print(output.shape)
Example of Sundial (Generative Forecasting)
import torch
from transformers import AutoModelForCausalLM
# load pretrain model
# supports different lookback/forecast lengths
model = AutoModelForCausalLM.from_pretrained('thuml/sundial-base-128m', trust_remote_code=True)
# prepare input
batch_size, lookback_length = 1, 2880
seqs = torch.randn(batch_size, lookback_length)
# Note that Sundial can generate multiple probable predictions
forecast_length = 96
num_samples = 20
output = model.generate(seqs, max_new_tokens=forecast_length, num_samples=num_samples)
# use raw predictions for mean/quantiles/confidence-interval estimation
print(output.shape)
More usage examples are provided here. See our HuggingFace for more information.
For developers interested in fine-tuning large time-series models or pre-training on customized datasets, please use OpenLTM, including code scripts and checkpoint of various models.
For developers interested in applying large time-series models on other time series analysis tasks (e.g., imputation and anomaly detection), this repo contains scripts and checkpoints [README].
We collect Unified Time Series Datasets (UTSD), which encompass well-curated time series to facilitate the research on large time-series models. Our dataset is released in HuggingFace.
You can access the data from HuggingFace and load the data in the style of TSLib:
# huggingface-cli login
# export HF_ENDPOINT=https://hf-mirror.com
python ./scripts/UTSD/download_dataset.py
# dataloader
python ./scripts/UTSD/utsdataset.py
We provide code for evaluating time series datasets, which you can use to evaluate your Huggingface formatted dataset:
python ./scripts/UTSD/dataset_evaluation.py --root_path <dataset root path> --log_path <output log path>
If you meet troubles when accessing the data, you can also download UTSD in numpy from [Tsinghua Cloud] and use UTSD_Npy dataloader [here].
We propose Timer, a decoder-only pre-trained time series Transformer. We propose single-series sequence (S3) format, converting diverse series into unified 1D sequences. The predictive model can also be adapted for forecasting, imputation, and anomaly detection [README].
We proposed Timer-XL for unified time series forecasting. It can be used for supervised training or large-scale pre-training, explicitly modeling multi-dimensional time series [GitHub].
We proposed Sundial, a family of generative time series foundation models, which is pre-trained on a trillion (10^12) time points. The model can be applied for both point and probabilistic forecasting, making zero-shot forecasting within milliseconds [GitHub].
If you find this repo helpful, please cite our paper.
@inproceedings{liutimer,
title={Timer: Generative Pre-trained Transformers Are Large Time Series Models},
author={Liu, Yong and Zhang, Haoran and Li, Chenyu and Huang, Xiangdong and Wang, Jianmin and Long, Mingsheng},
booktitle={Forty-first International Conference on Machine Learning}
}
@article{liu2024timer,
title={Timer-XL: Long-Context Transformers for Unified Time Series Forecasting},
author={Liu, Yong and Qin, Guo and Huang, Xiangdong and Wang, Jianmin and Long, Mingsheng},
journal={arXiv preprint arXiv:2410.04803},
year={2024}
}
@article{liu2025sundial,
title={Sundial: A Family of Highly Capable Time Series Foundation Models},
author={Liu, Yong and Qin, Guo and Shi, Zhiyuan and Chen, Zhi and Yang, Caiyin and Huang, Xiangdong and Wang, Jianmin and Long, Mingsheng},
journal={arXiv preprint arXiv:2502.00816},
year={2025}
}
We appreciate the following GitHub repos a lot for their valuable code and datasets:
If you have any questions or want to use the code, feel free to contact:
96 commits
8 commits
Python
93.3%
Shell
6.7%