返回资讯中心
外部精选
软件工程
#开发者实时流

Mistral Timestral

Timestral is a family of time series foundation models for multivariate probabilistic forecasting, with support for past-only and known-future covariates.

Hacker News 最新theanonymousone2026/10/15 · 22 天前13 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

Blog post · Hugging Face collection · License

Timestral is a family of time series foundation models for multivariate probabilistic forecasting, with support for past-only and known-future covariates. This repository provides standalone inference for Timestral models. It needs only PyTorch, NumPy, safetensors and huggingface_hub, and runs on CPU or GPU.

License: the code in this repository is licensed under Apache 2.0. The Timestral model weights are released separately on the Hugging Face Hub under a Modified MIT license. See License.

At launch, Timestral-209M ranked first among pretrained and zero-shot models on the three main public forecasting benchmarks:

All four sizes (5M, 28M, 123M, 209M) sit on the Pareto front of accuracy versus model size. Full results are in the blog post and the model cards on Hugging Face.

pip install git+https://github.com/mistralai/timestral.git # Python >= 3.10, torch >= 2.4

Or from a clone with uv, using the versions pinned in uv.lock:

git clone https://github.com/mistralai/timestral.git && cd timestral uv sync --frozen source .venv/bin/activate

Models

The weights are on the Hugging Face Hub, in the Mistral AI organization:

from_pretrained downloads config.json and model.safetensors once to the Hub cache.

import numpy as np from timestral import TimestralForecaster

forecaster = TimestralForecaster.from_pretrained("mistralai/Timestral-209M") # device="cuda" for a GPU

context = np.random.randn(2, 1, 2000).cumsum(-1) # (series, variates, time); NaN = missing forecast = forecaster.forecast(context, prediction_length=96)

forecast.quantiles.shape # (2, 1, 96, 21): series, variates, horizon, quantile levels forecast.quantile_levels # (0.01, 0.05, 0.1, ..., 0.9, 0.95, 0.99) forecast.median # (2, 1, 96) forecast.quantile(0.9) # (2, 1, 96)

context can be (B, V, T), (B, T) (one variate per series) or (T,) (one series), as a NumPy array or a torch tensor. The variates of a series are forecast jointly.

NaN marks a missing value. observation_mask (same shape, False = missing) can mark more.

The context is capped at the trained length (32768 steps); the most recent steps are kept.

Horizons longer than one decode block (32 patches = 1024 steps) are forecast block by block; each block's median is fed back as context.

Loading options

from_pretrained takes a Hub repo id or a local directory with config.json and model.safetensors.

forecast = forecaster.forecast( context, # (B, V, T) prediction_length=96, past_covariates=past, # (B, C_past, T): known over the context only known_covariates=known, # (B, C_known, T + 96): known over context and horizon )

Covariates are conditioning rows: they are not forecast, and covariate rows never read the targets. Known-future covariate rows whose values are all 0 or 1 are treated as indicators. NaN marks a missing covariate value.

forecast = forecaster.forecast( context, prediction_length=96, categorical_past_covariates=codes_past, # (B, C, T) numeric category codes, NaN = missing categorical_known_covariates=codes_known, # (B, C, T + 96) )

Pass categories as numeric codes (for example pandas.factorize), with NaN for missing values and for any padding. For a univariate target each categorical row is target-encoded per series: category c becomes (mean + sum_c) / (1 + count_c) over the forward-filled context, missing values form their own category, and a category absent from the context maps to the series mean. Multivariate targets receive the raw codes. Encoded rows are appended after the numeric covariates. timestral.covariate_encoding.target_encode exposes the encoding.

Timestral is a causal patch-based transformer trained with Decoupled Horizon Forecasting (DHF), where forecasts are generated from separate prediction tokens that read the causally encoded context. Each variate is a target, a past-only covariate or a known-future covariate: covariates pass information to targets but never read them, and only known-future covariates see the forecast horizon. A quantile head outputs 21 non-crossing quantiles per time step, and each forecast patch is denormalized with the statistics of the context and the block's earlier predicted medians.

Timestral is evaluated zero-shot on three benchmarks, with the forecaster defaults and the full history up to 32768 steps as context:

We do not accept pull requests. Bug reports and questions are welcome as GitHub issues.

timestral is maintained by the team at Mistral AI. We answer issues on a best-effort basis and fix security vulnerabilities and major bugs. See CONTRIBUTING.md for how to report an issue.

The code in this repository (the timestral package and tests) is licensed under the Apache License 2.0. See the LICENSE file.

The Timestral model weights are not covered by the Apache License 2.0. They are distributed separately on the Hugging Face Hub under a Modified MIT license, available in each model repository (Timestral-5M, Timestral-28M, Timestral-123M, Timestral-209M). When using the model weights, you must not use them in a manner that infringes, misappropriates, or otherwise violates any third party's rights, including intellectual property rights.

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →