From 0bc34cf62e2d413e40af8998e64d6548a3c5d11a Mon Sep 17 00:00:00 2001 From: HALF111 <1275113530@qq.com> Date: Sun, 9 Nov 2025 10:39:20 +0000 Subject: [PATCH] update code for VisionTSpp-large --- README.md | 11 +++++++---- visionts/model.py | 19 +++++++++++++------ visionts/models_mae.py | 2 ++ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e8fc358..0eb25e4 100644 --- a/README.md +++ b/README.md @@ -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%2FxAAxEAABAwIEB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AJZSPepbGOZdZUDD4IBr0SFdNFxVtw9taKywx4DEk%2Fpr%2F%2F2Q%3D%3D)](https://aihorizonforecast.substack.com/p/visionts-building-high-performance) [![ζœΊε™¨δΉ‹εΏƒ](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) @@ -20,10 +21,13 @@ _Visual Masked Autoencoders Are Free-Lunch Zero-Shot Time Series Forecasters_ | πŸ”— Citation

+## πŸŽ‰ 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 @@ -139,4 +143,3 @@ bash scripts/vision_ts_fullshot/$SOME_DATASET.sh - diff --git a/visionts/model.py b/visionts/model.py index bef09c7..083ef75 100644 --- a/visionts/model.py +++ b/visionts/model.py @@ -162,6 +162,7 @@ def forward(self, x, export_image=False, fp64=False): return y + # huggingface repository name: VISIONTSPP_REPO_ID = "Lefei/VisionTSpp" @@ -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()): diff --git a/visionts/models_mae.py b/visionts/models_mae.py index 1919978..35c2735 100644 --- a/visionts/models_mae.py +++ b/visionts/models_mae.py @@ -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% @@ -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, ]