Skip to main content

A time series foundation model.

Project description

TimesFM

TimesFM (Time Series Foundation Model) is a pretrained time-series foundation model developed by Google Research for time-series forecasting.

This open version is not an officially supported Google product.

Latest Model Version: TimesFM 2.5

Archived Model Versions:

  • 1.0 and 2.0: relevant code archived in the sub directory v1. You can pip install timesfm==1.3.0 to install an older version of this package to load them.

Update - June 5, 2026

Updated PyPI to timesfm=2.0.0. See Install.

Update - Apr. 9, 2026

Added fine-tuning example using HuggingFace Transformers + PEFT (LoRA) — see timesfm-forecasting/examples/finetuning/. Also added unit tests (tests/) and incorporated several community fixes.

Shoutout to @kashif and @darkpowerxo.

Update - Mar. 19, 2026

Huge shoutout to @borealBytes for adding the support for AGENTS! TimesFM SKILL.md is out.

Update - Oct. 29, 2025

Added back the covariate support through XReg for TimesFM 2.5.

Update - Sept. 15, 2025

TimesFM 2.5 is out!

Comparing to TimesFM 2.0, this new 2.5 model:

  • uses 200M parameters, down from 500M.
  • supports up to 16k context length, up from 2048.
  • supports continuous quantile forecast up to 1k horizon via an optional 30M quantile head.
  • gets rid of the frequency indicator.
  • has a couple of new forecasting flags.

Since the Sept. 2025 launch, the following improvements have been completed:

  1. ✅ Flax version of the model for faster inference.
  2. ✅ Covariate support via XReg (see Oct. 2025 update).
  3. ✅ Documentation, examples, and agent skill (see timesfm-forecasting/).
  4. ✅ Fine-tuning example with LoRA via HuggingFace Transformers + PEFT (see timesfm-forecasting/examples/finetuning/).
  5. ✅ Unit tests for core layers, configs, and utilities (see tests/).

Install

From PyPI

# Install the package with torch
pip install timesfm[torch]
# Or with Flax
pip install timesfm[flax]
# And when XReg is needed
pip install timesfm[xreg]

Local Install

  1. Clone the repository:

    git clone https://github.com/google-research/timesfm.git
    cd timesfm
    
  2. Create a virtual environment and install dependencies using uv:

    # Create a virtual environment
    uv venv
    
    # Activate the environment
    source .venv/bin/activate
    
    # Install the package in editable mode with torch
    uv pip install -e .[torch]
    # Or with flax
    uv pip install -e .[flax]
    # And when XReg is needed
    uv pip install -e .[xreg]
    
  3. [Optional] Install your preferred torch / jax backend based on your OS and accelerators (CPU, GPU, TPU or Apple Silicon).:

Code Example

import torch
import numpy as np
import timesfm

torch.set_float32_matmul_precision("high")

model = timesfm.TimesFM_2p5_200M_torch.from_pretrained("google/timesfm-2.5-200m-pytorch")

model.compile(
    timesfm.ForecastConfig(
        max_context=1024,
        max_horizon=256,
        normalize_inputs=True,
        use_continuous_quantile_head=True,
        force_flip_invariance=True,
        infer_is_positive=True,
        fix_quantile_crossing=True,
    )
)
point_forecast, quantile_forecast = model.forecast(
    horizon=12,
    inputs=[
        np.linspace(0, 1, 100),
        np.sin(np.linspace(0, 20, 67)),
    ],  # Two dummy inputs
)
point_forecast.shape  # (2, 12)
quantile_forecast.shape  # (2, 12, 10): mean, then 10th to 90th quantiles.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

timesfm-2.0.2.tar.gz (44.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

timesfm-2.0.2-py3-none-any.whl (44.8 kB view details)

Uploaded Python 3

File details

Details for the file timesfm-2.0.2.tar.gz.

File metadata

  • Download URL: timesfm-2.0.2.tar.gz
  • Upload date:
  • Size: 44.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for timesfm-2.0.2.tar.gz
Algorithm Hash digest
SHA256 b03885d3467b09314a4b461e1f6729375844061dd31fd41e3c35aa503c333da3
MD5 8aab1d24d59a11e3f4998d97b4f6f741
BLAKE2b-256 4816503864c985a1f213ae6182ece73b6538c468b5cd5c21158ede9db3333732

See more details on using hashes here.

File details

Details for the file timesfm-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: timesfm-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 44.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for timesfm-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c7bde94beb1651e1251cdf1e9d09cf6f015e0218d038a4a836a170dc70b08071
MD5 7f6106b02c35b64079e906eacff21bcc
BLAKE2b-256 cef23a7ed286070526a0e48487fdfd3b7ca25f90dd0205fd87f4bb27e15ad4fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page