Skip to main content

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.

Fork Notice (tsagentkit)

This repository is a fork of google-research/timesfm, published to PyPI as tsagentkit-timesfm to support the tsagentkit project without a GitHub dependency. The Python import name remains timesfm.

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 - 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.

Along with the model upgrade we have also upgraded the inference API. This repo will be under construction over the next few weeks to

  1. add support for an upcoming Flax version of the model (faster inference).
  2. add back covariate support.
  3. populate more docstrings, docs and notebook.

Install

  1. Install from PyPI:

    pip install "tsagentkit-timesfm[torch]"
    # Or with flax
    pip install "tsagentkit-timesfm[flax]"
    # Or XReg support
    pip install "tsagentkit-timesfm[xreg]"
    
  2. [Optional] Install your preferred torch / jax backend based on your OS and accelerators (CPU, GPU, TPU or Apple Silicon).:

From Source (optional)

git clone https://github.com/LeonEthan/timesfm.git
cd timesfm

uv venv
source .venv/bin/activate

uv pip install -e .[torch]
# Or with flax
uv pip install -e .[flax]
# Or XReg support
uv pip install -e .[xreg]

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.

Metadata

Release files for tsagentkit-timesfm 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tsagentkit-timesfm 1.0.1
File Size Uploaded Provenance Actions
tsagentkit_timesfm-1.0.1.tar.gz 33.9 kB Without provenance Details for tsagentkit_timesfm-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tsagentkit-timesfm 1.0.1
File Interpreter ABI Platform Actions
tsagentkit_timesfm-1.0.1-py3-none-any.whl Python 3 none any Details for tsagentkit_timesfm-1.0.1-py3-none-any.whl

Total release size: 78.0 kB

Release files / tsagentkit_timesfm-1.0.1.tar.gz

Download URL tsagentkit_timesfm-1.0.1.tar.gz
Size 33.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6aef3a3617aa29d2e926fb1a5bb7b51f90715d60579c6a760eee443ab2eb003e
BLAKE2b-256 checksum
How to use checksums
47f940bb964d3233aed2c5d76206cf0a833571d300dd2731776032c911c7bded
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / tsagentkit_timesfm-1.0.1-py3-none-any.whl

Download URL tsagentkit_timesfm-1.0.1-py3-none-any.whl
Size 44.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de43165684108b58dfeb9097b5a26621f8aba2882ef885477fa41846b799f271
BLAKE2b-256 checksum
How to use checksums
e34fe4e23dfe0e130cac7815d32759813b1dde7b4cafcbfc0499a3669d1fe3de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Security for tsagentkit-timesfm 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page