Spaces:
Running
Download README.md from hrczggyorgy/TSFMs_forecasting: direct link, hf CLI and curl.
- Browser
- Download file 15.2 kB
-
https://huggingface.co/spaces/hrczggyorgy/TSFMs_forecasting/resolve/main/README.md
- Command line
-
hf download hf://spaces/hrczggyorgy/TSFMs_forecasting/README.md
-
curl -L -o README.md https://huggingface.co/spaces/hrczggyorgy/TSFMs_forecasting/resolve/main/README.md
title: Multi-Model Time-Series Forecasting Workbench
emoji: π
colorFrom: blue
colorTo: indigo
sdk: docker
app_port: 7860
pinned: false
Multi-Model Time-Series Forecasting Workbench
Live demo: https://huggingface.co/spaces/hrczggyorgy/TSFMs_forecasting
A modular zero-shot forecasting workbench with unified probabilistic outputs, leakage-free backtesting, and model license notices. The model selector only shows models installed for the active runtime profile.
Supported Models
| Model | Parameters | License | Multivariate | Covariates | Context | Horizon | Quantiles |
|---|---|---|---|---|---|---|---|
| TimesFM 2.5 | 200M | Apache-2.0 | No | No (current adapter does not consume covariates) | 16k | 512 | 9 (0.1-0.9) |
| TiRex-2 | 82M active | Apache-2.0 | Yes | Past and future-known | 32k | 1024 | 9 (0.1-0.9) |
| Chronos-T5 Small | 20M | Apache-2.0 | YesΒΉ | No | 512 | Model-dependent | Sampled |
| TimesFM 3.0 | 330M | Non-commercial v1.0 | Yes | Past and future-known | 15,360 | 1024 | 9 (0.1-0.9) |
| Moirai 1.1 Small | 14M | See model card | No | No | 2k | Configured horizon | Sampled |
| t0-gamma | 100M+ | Apache-2.0 | Yes | Past and future-known | 512 | 1024 | 21 (0.01-0.99) |
| Timestral 209M | 209M | Modified MIT ($20M cap) | Yes | No (current adapter does not consume covariates) | 32k | 1024 | 21 (0.01-0.99) |
| Timestral 28M | 28M | Modified MIT ($20M cap) | Yes | No (current adapter does not consume covariates) | 32k | 1024 | 21 (0.01-0.99) |
| Timestral 123M | 123M | Modified MIT ($20M cap) | Yes | No (current adapter does not consume covariates) | 32k | 1024 | 21 (0.01-0.99) |
| Timestral 5M | 5M | Modified MIT ($20M cap) | Yes | No (current adapter does not consume covariates) | 32k | 1024 | 21 (0.01-0.99) |
| STL Decomposition | β | Apache-2.0 (code) | YesΒΉ | No | At least 4 | Any | None |
ΒΉ STL models each target independently; it extrapolates the decomposed trend and repeats the final seasonal cycle. It provides deterministic point forecasts without prediction intervals.
The default timesfm25 profile includes TimesFM 2.5, TiRex-2, and Chronos. TimesFM 3.0 and Moirai are separate deployment profiles because their Python package requirements conflict with the default image. MOMENT is not offered for zero-shot forecasting: its upstream forecasting head requires fine-tuning. Lag-Llama is not currently integrated.
Features
Core Forecasting
- Zero-shot forecasting β no training required, works out-of-the-box
- Unified probabilistic interface β supported models provide quantiles from native outputs or forecast samples
- Multi-model comparison β run identical backtests across models with controlled context/horizon
- Multivariate support β available for TiRex-2 and TimesFM 3.0; other adapters may forecast targets independently
- Covariates β supported by TiRex-2, TimesFM 3.0, and t0-gamma; adapters that do not consume the inputs do not advertise support
Autonomous Hybrid Forecasting
- Select Autonomous hybrid in the sidebar to search installed, non-experimental models automatically; manual model selections are not used for this strategy.
- Base candidates are ranked on shared chronological rolling-origin folds by original-scale MAE, with RMSE as the tie-breaker.
- The chosen base model creates up to 20 blocked, expanding-window out-of-sample forecasts. Residual targets are
actual - base_prediction, and imputed observations are excluded. - Residual candidates include regularized native exogenous regression and ARX models. Installed TimesFM 3.0, TiRex-2, and t0-gamma adapters are also eligible because their inference paths consume both historical and future known covariates.
- Residual candidates are ranked by end-to-end hybrid accuracy on the original target scale. A final horizon-sized holdout is kept out of selection when enough history is available; shorter series are explicitly labeled as tuning-only.
- The result shows component forecasts, candidate scores and failures, residual count, holdout performance, and a CSV with base, correction, and hybrid forecasts.
- If residual training or inference fails, the app reports a base-only fallback. If base quantiles exist, shifting them by the residual point correction is labeled an approximate interval; residual uncertainty is not included.
- The search runs sequentially and is cached for the current prepared data, horizon, and relevant settings. Change settings or data and run it again to refresh the result.
Data & Diagnostics
- CSV upload with auto column detection (date + multiple targets)
- Data validation β irregular gaps, outliers, duplicates, stationarity (ADF), trend analysis
- Seasonal decomposition β STL with multiple candidate periods
- Frequency inference β robust detection with fallback to delta-mode
Evaluation & Backtesting
- Rolling-origin backtesting β expanding/sliding windows with observation mask filtering
- Comprehensive metrics: MAE, RMSE, MAPE, MASE, Bias, Pinball Loss, CRPS, Interval Coverage/Width
- Per-window & aggregate reporting β CSV export with forecast origin tracking
- Calibration diagnostics β coverage vs. nominal intervals, quantile crossing detection
- Note: RMSE aggregation uses mean of window-level RMSEs (approximate pooled RMSE)
Reproducibility & Export
- Long & wide format CSV exports β forecasts, quantiles, actuals, errors
- Metadata JSON β git commit, data fingerprint, model checkpoint, preprocessing, timing
- Run ID tracking β unique identifier for every forecast/backtest job
UX & Operations
- License notice shown for the selected model
- Model capability badges β multivariate, covariates, context, horizon, quantiles at a glance
- Autopilot mode β recommended horizon/context based on data frequency
- Docker-ready β CPU/GPU, persistent model cache volume
Quick Start
Local (Python 3.10+)
# Clone
git clone https://github.com/hrczggyrgy/time_series_foundation_models.git
cd time_series_foundation_models
# Create one Python 3.11 environment (matches the Docker image) and install dependencies
uv venv --seed venv --python 3.11
source venv/bin/activate
uv pip install -r requirements.txt
# Or with pip
python -m pip install -r requirements.txt
# Run
streamlit run app.py
Open http://localhost:8501
Docker (Recommended)
# Build
docker build -t tsfm-workbench .
# Run (persistent model cache)
docker run -d \
-p 7860:7860 \
-v $(pwd)/models:/home/user/.cache/huggingface \
tsfm-workbench
Hugging Face Spaces
Deploy directly from this repo β the Space auto-builds from the Dockerfile.
The GitHub Actions workflow_dispatch form can select timesfm25 (default), timesfm3, or moirai. The selected profile uses its corresponding Dockerfile and requirements file for that deployment.
Known Limitations
Quantile Handling
- TimesFM 2.5: Only supports P10-P90 quantiles. Requesting P05/P95 will clamp to P10/P90 with a warning. 90% intervals are effectively narrower than advertised.
- T0-Gamma: Returns quantiles at requested levels directly (no interpolation needed). Covariate support requires context+horizon alignment (not yet implemented).
- Timestral: Raises error if quantile computation fails (no silent fallback). Currently forecasts each target independently (not joint multivariate).
Backtesting
- Current implementation filters imputed points from evaluation using observation masks, but preprocessing is still applied to the full series before backtesting. Truly leakage-free backtesting would require re-running preprocessing at each forecast origin using only available training data.
- RMSE aggregation uses mean of window-level RMSEs, not pooled RMSE across all observations.
Model Availability
- TimesFM 3.0: Available through the separate profile only. Self-hosted weights are non-commercial/non-production; see the model license before use.
- Moirai: Available through the separate Uni2TS profile, which uses PyTorch <2.5.
- MOMENT: Not included in the forecast selector because its upstream forecasting head must be fine-tuned before forecasting.
- Lag-Llama: Not integrated; the project does not currently provide a maintained, versioned inference API for this adapter.
UI Capabilities
- Current UI selects one target column and runs one model per forecast operation. Multi-model comparison requires running separate forecasts.
Usage Workflow
1. DATA 2. DIAGNOSTICS 3. FORECAST 4. EVALUATION
Upload CSV / Demo Trend (p-value) Model select MAE / RMSE / MAPE
Column mapping Stationarity (ADF) Horizon / interval MASE / CRPS
Auto-fix gaps/dups Seasonal periods Model license notice Coverage / Width
Validation report Outlier count Backtest toggle Per-window table
Data Format
- Required: Date column + at least one numeric target column
- Optional: Past covariates, known-future covariates (future columns must extend
horizonsteps beyond last date) - Minimum: 32 observations (model-dependent)
Model Selection
- Select Model β capability details and its license notice appear in the sidebar.
- Review the model and weights license terms before use. The app does not filter models or enforce license eligibility.
Configuration
Environment Variables
| Variable | Default | Description |
|---|---|---|
HF_TOKEN |
β | Hugging Face token for higher rate limits / private models |
TORCH_THREADS |
4 | CPU threads for PyTorch |
Model Cache
Models download to ~/.cache/huggingface/hub/ on first use (~400MB-2GB each). Mount a volume in Docker for persistence:
-v /host/path/models:/home/user/.cache/huggingface
GPU Support
Install CUDA-enabled PyTorch:
uv pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
The app auto-detects CUDA/MPS/CPU.
Project Structure
βββ app.py # Streamlit UI (orchestrator)
βββ pyproject.toml # Packaging & optional dependencies
βββ requirements.txt # Pinned deployment requirements
βββ Dockerfile # Default TimesFM 2.5 profile
βββ Dockerfile.timesfm3 # Optional TimesFM 3.0 profile
βββ Dockerfile.moirai # Optional Moirai/Uni2TS profile
βββ .streamlit/config.toml # Streamlit server config
β
βββ forecasting/ # Core forecasting library
β βββ contracts.py # ForecastRequest, ForecastResult, ModelCapabilities, ForecastAdapter
β βββ registry.py # ModelRegistry
β βββ exceptions.py # Domain exceptions
β βββ service.py # ForecastingService (high-level orchestration)
β β
β βββ adapters/ # Model adapters (implement ForecastAdapter)
β β βββ base.py # BaseAdapter: quantile interp, crossing repair
β β βββ timesfm25.py # TimesFM 2.5
β β βββ timesfm3.py # TimesFM 3.0 profile
β β βββ tirex2.py # TiRex-2
β β βββ chronos.py # Chronos
β β βββ moirai.py # Moirai profile
β β βββ timestral.py # Timestral 5M/28M/123M/209M
β β βββ t0.py # t0-gamma
β β βββ stl.py # STL decomposition baseline
β β
β βββ data/
β β βββ parsing.py # CSV prep, validation, freq inference, date gen
β β
β βββ evaluation/
β β βββ metrics.py # MAE, RMSE, MAPE, MASE, Pinball, CRPS, intervals
β β βββ backtesting.py # Rolling-origin, leakage-free splits
β β
β βββ reporting/
β βββ exports.py # Long/wide CSV, metadata JSON
β
βββ docs/
β βββ model_compatibility.md # Verified model API/license matrix
β
βββ tests/ # Unit tests for adapter contracts, parsing, metrics
βββ unit/ # API contract tests (23 tests, all passing)
βββ integration/ # Component interaction tests (TODO)
βββ smoke/ # Tests against actual model checkpoints (TODO)
βββ fixtures/ # Test data and mocks (TODO)
License
Application code: Apache-2.0 (see LICENSE)
Model weights β see table above:
- Apache-2.0: TimesFM 2.5, TiRex-2, Chronos, t0-gamma
- STL baseline uses statsmodels under the project's Apache-2.0 application license
- Non-commercial v1.0: TimesFM 3.0 (self-hosted only; commercial via BigQuery ML)
- Modified MIT ($20M revenue cap): Timestral family (commercial license from Mistral AI)
This application does not grant rights absent from model licenses. Model selection is not license-gated; users are responsible for complying with each model's terms.
References
- TimesFM GitHub / HF / TimesFM 3.0
- Timestral HF / Mistral Blog
- t0-gamma HF / TFC Blog
- Model Compatibility Matrix
- Streamlit Docs
Contributing
- Fork & create feature branch
- Add model adapter in
forecasting/adapters/implementingForecastAdapter - Register in
forecasting/registry.pywith accurate capability and license notice metadata - Add entry to
docs/model_compatibility.md - Submit PR with smoke test results
Citation
If you use this workbench in research, please cite the underlying models:
@article{das2023timesfm,
title={A decoder-only foundation model for time-series forecasting},
author={Das, Abhimanyu and Kong, Weihao and Sen, Rajat and Zhou, Yichen},
journal={arXiv:2310.10688}, year={2023}
}
@article{meyer2026t0,
title={t0: A Time-Series Foundation Model for Forecasting with Context},
author={Meyer, Lucas and Sole, Claudio and others},
journal={arXiv:2609.24559}, year={2026}
}
@article{mistral2026timestral,
title={Timestral: Mistral's Time-Series Foundation Models},
author={Mistral AI}, year={2026}
}