Views
No views yet
Official model repository. This Hugging Face repository hosts the checkpoints used by the official Time-RCD GitHub project, as well as a Transformers-compatible model implementation. The recommended inference API isTimeRCDDetectorbelow.

time_rcd/ — a lightweight Python API for inference on your own data1conda create -n Time-RCD python=3.10
2conda activate Time-RCD
3
4git clone https://github.com/thu-sail-lab/Time-RCD.git
5cd Time-RCD
6pip install .pip install .HF_ENDPOINT=https://hf-mirror.com before running
the examples or loading a checkpoint.export HF_ENDPOINT=https://hf-mirror.com1import numpy as np
2from time_rcd import TimeRCDDetector
3
4data = np.load("my_series.npy") # shape (T,) or (T, C)
5
6detector = TimeRCDDetector.from_pretrained(variant="uni") # or "multi"
7scores = detector.predict(data) # shape (T,)variant="multi" when C > 1:1detector = TimeRCDDetector.from_pretrained(variant="multi")
2scores = detector.predict(multivariate_data) # shape (T, C) -> scores (T,)1detector = TimeRCDDetector.from_local(
2 "best_model/pretrain_checkpoint_best_uni.pth",
3 variant="uni",
4)python examples/quickstart.pyTimeRCDDetector API above is recommended, especially for multivariate data.
For univariate data, the following loads the same official uni checkpoint:1import numpy as np
2from transformers import AutoModel
3
4model = AutoModel.from_pretrained(
5 "thu-sail-lab/Time-RCD",
6 trust_remote_code=True,
7).eval()
8
9data = np.load("my_series.npy") # shape: (T,)
10score_chunks, _ = model.zero_shot(data)
11scores = np.concatenate([chunk.reshape(-1) for chunk in score_chunks])[: len(data)]zero_shot() applies the same global normalization and windowing semantics as
the official TimeRCDDetector inference API. The published Transformers
configuration is univariate; use TimeRCDDetector.from_pretrained(variant="multi")
for multivariate inference..
├── time_rcd/ # User-facing inference API
│ ├── detector.py # TimeRCDDetector
│ └── _core/ # Time-RCD inference model implementation
├── examples/
│ └── quickstart.py # Minimal inference example
├── Tutorial.md # Guide for your own data
├── pyproject.toml # Package metadata and dependencies
├── zero-shot.png # Model overview
└── README.mdtsb-ad-integration
branch. For the lightweight zero-shot inference API, use the main branch.1@misc{lan2025foundationmodelszeroshottime,
2 title={Towards Foundation Models for Zero-Shot Time Series Anomaly Detection: Leveraging Synthetic Data and Relative Context Discrepancy},
3 author={Tian Lan and Hao Duong Le and Jinbo Li and Wenjun He and Meng Wang and Chenghao Liu and Chen Zhang},
4 year={2025},
5 eprint={2509.21190},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG},
8 url={https://arxiv.org/abs/2509.21190},
9}