Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

_Visual Masked Autoencoders Are Free-Lunch Zero-Shot Time Series Forecasters_

[![Paper](https://img.shields.io/badge/paper-2408.17253-red)](https://arxiv.org/abs/2408.17253)
[![VisionTS](https://img.shields.io/badge/VisionTS-2408.17253-red)](https://arxiv.org/abs/2408.17253)
[![VisionTS++](https://img.shields.io/badge/VisionTS++-2508.04379-red)](https://arxiv.org/abs/2508.04379)
[![PyPI - Version](https://img.shields.io/pypi/v/visionts)](#-quick-start)
[![AI horizon forecast](https://img.shields.io/badge/AI_horizon_forecast-black?logo=data%3Aimage%2Fjpeg%3Bbase64%2C%2F9j%2F4AAQSkZJRgABAQAAAQABAAD%2F2wCEAAQEBAQEBAQEBAQGBgUGBggHBwcHCAwJCQkJCQwTDA4MDA4MExEUEA8QFBEeFxUVFx4iHRsdIiolJSo0MjRERFwBBAQEBAQEBAQEBAYGBQYGCAcHBwcIDAkJCQkJDBMMDgwMDgwTERQQDxAUER4XFRUXHiIdGx0iKiUlKjQyNEREXP%2FCABEIADAAMAMBIgACEQEDEQH%2FxAAcAAABBAMBAAAAAAAAAAAAAAAHAAQFBgECCAP%2F2gAIAQEAAAAA4by52aKaakJyNMdZgMxvee73dCJ5%2Bdhg%2BLJ6J2IY7r6SS%2F%2FEABkBAAIDAQAAAAAAAAAAAAAAAAMGAQIEBf%2FaAAgBAhAAAAB33c9jJRYk3%2F%2FEABcBAAMBAAAAAAAAAAAAAAAAAAQFBwD%2F2gAIAQMQAAAATKm88APoWH%2F%2FxAAxEAABAwIEBQEFCQAAAAAAAAABAgMEAAUGERITByExUWEiFEFCUqIjM0NTYnFykZL%2F2gAIAQEAAT8A2vIraqLBXJdS0jmo%2B6pluehull4aVDqD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![机器之心](https://img.shields.io/badge/%E6%9C%BA%E5%99%A8%E4%B9%8B%E5%BF%83-black?logo=wechat&logoColor=white)](https://mp.weixin.qq.com/s/vTPkbu5ANYBGO4KYKZfAyg)
Expand All @@ -20,10 +21,13 @@ _Visual Masked Autoencoders Are Free-Lunch Zero-Shot Time Series Forecasters_
| 🔗&nbsp;<a href="#-citation">Citation</a>
</p>

## 🎉 What's New

- 🔥 Our paper is accepted by ICML 2025!
- 🔥 Aug 2025: We released [VisionTS++](https://arxiv.org/abs/2508.04379), a SOTA time series foundation model by continual pretraining visual MAE on large-scale time series data, supporting multi-channel forecasting and probablistic forecasting!

- 🔥 VisionTS achieved the **#1** rank 🏆 for zero-shot point forecasting (MASE) on [GIFT-EVAL](https://huggingface.co/spaces/Salesforce/GIFT-Eval) (as of Nov 2024, surpassing Moirai, TimesFM, chronos, etc) — **without any time series training**!
- May 2025: Our paper is accepted by ICML 2025!

- Nov 2024: VisionTS achieved the **#1** rank 🏆 for zero-shot point forecasting (MASE) on [GIFT-EVAL](https://huggingface.co/spaces/Salesforce/GIFT-Eval) (as of Nov 2024, surpassing Moirai, TimesFM, chronos, etc) — **without any time series training**!

## 🔍 About

Expand Down Expand Up @@ -139,4 +143,3 @@ bash scripts/vision_ts_fullshot/$SOME_DATASET.sh
</a>
</div>


19 changes: 13 additions & 6 deletions visionts/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def forward(self, x, export_image=False, fp64=False):
return y



# huggingface repository name:
VISIONTSPP_REPO_ID = "Lefei/VisionTSpp"

Expand All @@ -181,22 +182,28 @@ def __init__(self, arch='mae_base', finetune_type='ln', ckpt_dir='./ckpt/', ckpt

if load_ckpt:
if ckpt_path is None:
ckpt_path = os.path.join(ckpt_dir, "visiontspp_model.ckpt")
ckpt_path = os.path.join(ckpt_dir, "visiontspp_base.ckpt")

if not os.path.isfile(ckpt_path):
# local directory to save the model
local_dir = Path(ckpt_path).parent

# Download model from HuggingFace
snapshot_download(
repo_id=VISIONTSPP_REPO_ID,
local_dir=local_dir,
local_dir_use_symlinks=False
)
try:
snapshot_download(
repo_id=VISIONTSPP_REPO_ID,
local_dir=local_dir,
local_dir_use_symlinks=False
)
except Exception as e:
print(f"Failed to download model from HuggingFace. Please check the internet connection and try again.")
print(f"Error: {e}")
raise

try:
print(f"Load {ckpt_path}")
checkpoint = torch.load(ckpt_path, map_location='cpu')

# quantile model:
if not quantile:
for k in list(checkpoint['model'].keys()):
Expand Down
2 changes: 2 additions & 0 deletions visionts/models_mae.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def __init__(self, img_size=224, patch_size=16, in_chans=3,

# prediction head
self.decoder_pred = nn.Linear(decoder_embed_dim, patch_size**2 * in_chans, bias=True) # decoder to patch

if self.quantile:
# adds quantile outputs:
# we need 9 outputs in total, corresponding to 10%, 20%, ..., 90%
Expand Down Expand Up @@ -212,6 +213,7 @@ def forward_decoder(self, x, ids_restore):
x = self.decoder_pred(x)
x = x[:, 1:, :] # remove cls token
return x

else:
# first calculate the 50% quantile value
x_mid = self.decoder_pred(x)[:, 1:, :] # [batch, ]
Expand Down