Skip to main content



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 to TimesFM.compile(). Defaults to ForecastConfigBM().
  • forecast_horizon (int, optional): Number of future steps to predict for each input series. Defaults to 12.
  • validation_mode (bool, optional): If True, reserves the last forecast_horizon points for validation. Defaults to False.
  • 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 to None (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-names to show a list with all the available Template names installed with Sinapsis TimesFM.

[!TIP] Use CLI command sinapsis info --example-template-config TEMPLATE_NAME to 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.

Metadata

Release files for sinapsis-timesfm 0.1.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 sinapsis-timesfm 0.1.1
File Size Uploaded
sinapsis_timesfm-0.1.1.tar.gz 45.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sinapsis-timesfm 0.1.1
File Interpreter ABI Platform
sinapsis_timesfm-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 78.0 kB

Release files / sinapsis_timesfm-0.1.1.tar.gz

Download URL sinapsis_timesfm-0.1.1.tar.gz
Size 45.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2a7e36b8089c59c695f18838c346a6fa06e1c8ed1caf8f10ab04b1e9287f7053
BLAKE2b-256 checksum
How to use checksums
fd6921510b66219c4084f4562c09825417f5c7bee10e89039019038c8d49f729
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.16

Release files / sinapsis_timesfm-0.1.1-py3-none-any.whl

Download URL sinapsis_timesfm-0.1.1-py3-none-any.whl
Size 32.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa6f3889c3b31d616ac1a01caea68ee224f5b7e86784d0b007916bac6d257ceb
BLAKE2b-256 checksum
How to use checksums
13296f0fcba43b948e24e338117b73c57e965a964f93d70420ed432f985e4cf7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.16

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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