TimesFM fork distribution for tsagentkit.
Project description
TimesFM
TimesFM (Time Series Foundation Model) is a pretrained time-series foundation model developed by Google Research for time-series forecasting.
- Paper: A decoder-only foundation model for time-series forecasting, ICML 2024.
- All checkpoints: TimesFM Hugging Face Collection.
- Google Research blog.
- TimesFM in BigQuery: an official Google product.
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 canpip install timesfm==1.3.0to 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
frequencyindicator. - 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
- add support for an upcoming Flax version of the model (faster inference).
- add back covariate support.
- populate more docstrings, docs and notebook.
Install
-
Install from PyPI:
pip install "tsagentkit-timesfm[torch]" # Or with flax pip install "tsagentkit-timesfm[flax]" # Or XReg support pip install "tsagentkit-timesfm[xreg]"
-
[Optional] Install your preferred
torch/jaxbackend based on your OS and accelerators (CPU, GPU, TPU or Apple Silicon).:
- Install PyTorch.
- Install Jax for Flax.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tsagentkit_timesfm-1.0.0.tar.gz.
File metadata
- Download URL: tsagentkit_timesfm-1.0.0.tar.gz
- Upload date:
- Size: 33.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b2d4a8f9fb99a22734eec6ef77720481cd1caaa6e26798783ee31aa08a055a1
|
|
| MD5 |
d8ed98b5e81a3f2bb921725767a05934
|
|
| BLAKE2b-256 |
a7fbc6f4c50492b6b8d5dda36edec4cfcc5c0565b5ddf5ba66409df3c081a4bf
|
File details
Details for the file tsagentkit_timesfm-1.0.0-py3-none-any.whl.
File metadata
- Download URL: tsagentkit_timesfm-1.0.0-py3-none-any.whl
- Upload date:
- Size: 44.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19569e5b56773363acd99f0c807c131faf8062815d2a49fb18f0edeb55f145f8
|
|
| MD5 |
b818866fc2c081ba3264151299e2362b
|
|
| BLAKE2b-256 |
ea37fd8a12dae295cbeabb12dcde8fd87c886c815204a74d0c18ff2620767508
|