Module for time series forecasting using Google's TimesFM foundation model.
Project description
Sinapsis TimesFM
Module for time series forecasting using Google's TimesFM foundation model.
🐍 Installation • 🚀 Features • 📚 Usage Example • 📙 Documentation • 🔍 License
Sinapsis TimesFM provides zero-shot time series forecasting using Google's TimesFM foundation model. It supports both pandas DataFrame and Darts TimeSeries outputs, including point and quantile predictions.
🐍 Installation
Install using your package manager of choice. We encourage the use of uv
Example with uv:
uv pip install sinapsis-timesfm --extra-index-url https://pypi.sinapsis.tech
or with raw pip:
pip install sinapsis-timesfm --extra-index-url https://pypi.sinapsis.tech
[!NOTE] TimesFM supports multiple backends. Install the one you need:
uv pip install sinapsis-timesfm[torch] --extra-index-url https://pypi.sinapsis.tech # PyTorch uv pip install sinapsis-timesfm[flax] --extra-index-url https://pypi.sinapsis.tech # Flax/JAX uv pip install sinapsis-timesfm[all] --extra-index-url https://pypi.sinapsis.tech # All backends
🚀 Features
Templates Supported
TimesFM
Zero-shot time series forecasting template powered by Google's TimesFM 2.5 foundation model. Accepts pandas DataFrames or Darts TimeSeries as input, automatically sorts by time, and produces point forecasts with optional quantile predictions.
The following attributes apply to the TimesFM template:
model_name(str, optional): Hugging Face model identifier for TimesFM. Defaults to"google/timesfm-2.5-200m-pytorch".forecasting_config(ForecastConfigBM, optional): Forecasting behavior configuration passed toTimesFM.compile(). Defaults toForecastConfigBM().forecast_horizon(int, optional): Number of future steps to predict for each input series. Defaults to12.validation_mode(bool, optional): IfTrue, reserves the lastforecast_horizonpoints for validation. Defaults toFalse.time_series_output_format(Literal, optional): Output format for predictions. One of"pandas_dataframe"or"darts_series". Defaults to"pandas_dataframe".device(str, optional): Torch device used for inference, for example"cpu"or"cuda:0". Defaults to"cpu".time_format(str | None, optional): Explicit datetime format for parsing and formatting. Defaults toNone(auto-inferred).time_column_name(str, optional): Name of the time column in the input dataframe. Defaults to"Date".
[!TIP] Use CLI command
sinapsis info --all-template-namesto show a list with all the available Template names installed with Sinapsis TimesFM.
[!TIP] Use CLI command
sinapsis info --example-template-config TEMPLATE_NAMEto produce an example Agent config for the Template specified in TEMPLATE_NAME.
For example, for TimesFM use sinapsis info --example-template-config TimesFM to produce the following example config:
agent:
name: my_test_agent
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: TimesFM
class_name: TimesFM
template_input: InputTemplate
attributes:
model_name: google/timesfm-2.5-200m-pytorch
forecasting_config:
max_context: 0
max_horizon: 0
normalize_inputs: false
window_size: 0
per_core_batch_size: 1
use_continuous_quantile_head: false
force_flip_invariance: true
infer_is_positive: true
fix_quantile_crossing: false
return_backcast: false
forecast_horizon: 12
validation_mode: false
time_series_output_format: pandas_dataframe
device: cpu
time_format: null
time_column_name: Date
📚 Usage Example
Below is an example configuration for Sinapsis TimesFM that loads a CSV file into a time series packet and runs zero-shot forecasting with a 30-step horizon on GPU.
Example config
agent:
name: TimesFMForecastingAgent
description: 'Agent for zero-shot time series forecasting using TimesFM'
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: TimeSeriesFromCSVLoader
class_name: TimeSeriesFromCSVLoader
template_input: InputTemplate
attributes:
root_dir: ./artifacts
assign_to: "content"
loader_params:
path_to_csv: "bitcoin.csv"
time_col: "Date"
value_cols: ["open", "high", "low", "close", "Volume BTC", "Volume USD"]
freq: "D"
- template_name: TimesFM
class_name: TimesFM
template_input: TimeSeriesFromCSVLoader
attributes:
model_name: google/timesfm-2.5-200m-pytorch
forecast_horizon: 30
validation_mode: false
time_series_output_format: pandas_dataframe
device: cuda:0
time_column_name: Date
This configuration defines an agent and a sequence of templates to load data and generate forecasts.
To run the config, use the CLI:
sinapsis run name_of_config.yml
📙 Documentation
Documentation for this and other sinapsis packages is available on the sinapsis website
Tutorials for different projects within sinapsis are available at sinapsis tutorials page
🔍 License
This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the LICENSE file.
For commercial use, please refer to our official Sinapsis website for information on obtaining a commercial license.
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 sinapsis_timesfm-0.1.0.tar.gz.
File metadata
- Download URL: sinapsis_timesfm-0.1.0.tar.gz
- Upload date:
- Size: 45.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c279a6e19113ee3a7e473a36e0c88d1a05fe640fe1ab4140aed489817b72396d
|
|
| MD5 |
16c057119da0bd0c625ecf31872a92ff
|
|
| BLAKE2b-256 |
ae1a5b390a0c8df331e55977b79584743bca7720160673becca52b9661411440
|
File details
Details for the file sinapsis_timesfm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sinapsis_timesfm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 32.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb3a09816be567d0648f343ebf302d6ef222b2b32828cb380a9de271c445d600
|
|
| MD5 |
bc0d4e5389ac09b6c7b45dcb6f73d97d
|
|
| BLAKE2b-256 |
71d3842abf5515c053dc289a39dfb96269da7485cae59fa8d11eec19174281fa
|