--- license: mit pipeline_tag: time-series-forecasting --- # Large Time-Series Model (Timer) [Large time-series model](https://cloud.tsinghua.edu.cn/f/b766629dbc584a4e8563/) introduced in this [paper](https://arxiv.org/abs/2402.02368) and enhanced with our [further work](https://arxiv.org/abs/2410.04803). The base version is pre-trained on **307B** time points, which supports zero-shot forecasting and further adpatation. * Zero-shot forecasting benchmarks: [TSLib Dataset](https://cdn-uploads.huggingface.co/production/uploads/64fbe24a2d20ced4e91de38a/n2IW7fTRpuZFMYoPr1h4O.png), [GIFT-Eval](). * Codebase for fine-tuning: [Large-Time-Series-Model](https://github.com/thuml/Large-Time-Series-Model). # Quickstart ``` import torch from transformers import AutoModelForCausalLM # load pretrain model model = AutoModelForCausalLM.from_pretrained('thuml/timer-base', trust_remote_code=True, token=True) # prepare input seqs = torch.randn(2, 2880) # batch_size x input_len mean, std = seqs.mean(dim=-1, keepdim=True), seqs.std(dim=-1, keepdim=True) normed_seqs = (seqs - mean) / std # forecast prediction_length = 96 output = model.generate(normed_seqs, max_new_tokens=prediction_length)[:, -prediction_length:] print(output.shape) ``` ## Specification * Architecture: Causal Transformer (Decoder-only) * Pre-training Scale: 307 time points * Context Length: up to 2880 * Parameter Count: 67M * Patch Length: 96 * Number of Layers: 8 ## Acknowledgments This work was supported by the National Natural Science Foundation of China (62022050 and U2342217), the BNRist Innovation Fund (BNR2024RC01010), and the National Engineering Research Center for Big Data Software. The model is mostly built from the Internet public time series dataset, which comes from different research teams and providers. We sincerely thank all individuals and organizations who have contributed the data. Without their generous sharing, this model would not have existed. ## Citation ``` @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} } ```