Skip to content
Skillv1.0.0

timesfm

Forecast time series data using Google's TimesFM foundation model with zero-shot prediction. Use when: forecasting sales or demand, predicting server metrics, financial time series analysis, anomaly d

by terminalskills(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from terminalskills/skills (skills/timesfm/SKILL.md). Install upstream with npx skills add terminalskills/skills --skill timesfm. Copyright stays with the author (Apache-2.0).

TimesFM

Overview

TimesFM is a 200M-parameter foundation model by Google Research, pretrained on 100 billion real-world time points. It performs zero-shot forecasting across domains — no fine-tuning required. Feed it historical data, get predictions immediately.

Instructions

Installation

pip install timesfm

Basic Forecasting

import timesfm
import numpy as np

# Initialize model
tfm = timesfm.TimesFm(
    hparams=timesfm.TimesFmHparams(
        per_core_batch_size=32,
        horizon_len=30,
    ),
    checkpoint=timesfm.TimesFmCheckpoint(
        huggingface_repo_id="google/timesfm-2.0-200m-pytorch",
    ),
)

# Your historical data (e.g., daily sales for 1 year)
history = np.array([120, 135, 128, 142, 155, 148, 160, ...])

# Forecast next 30 days
forecasts = tfm.forecast([history], freq=[1])
predictions = forecasts[0]  # shape: (30,)

Frequency Parameter

Set freq to match your data granularity:

  • 0: High frequency (seconds/minutes)
  • 1: Daily
  • 2: Weekly/Monthly

Multi-Series Forecasting

# Forecast multiple product categories at once
series = [sales_electronics, sales_clothing, sales_food]
forecasts = tfm.forecast(series, freq=[1, 1, 1])
# Returns list of 3 forecast arrays

Examples

Example 1: Demand forecasting

Input: 365 days of daily product sales data. Output: 30-day forecast with the model capturing weekly seasonality and growth trend automatically.

history = load_csv("daily_sales.csv")["quantity"].values
forecast = tfm.forecast([history], freq=[1])[0]
print(f"Next 7 days: {forecast[:7]}")
# Next 7 days: [182, 175, 190, 168, 195, 201, 178]

Example 2: Server metrics anomaly detection

Input: 720 hours (30 days) of CPU utilization. Output: Forecast next 24 hours. Flag if actual exceeds forecast by 2x standard deviation.

cpu_history = get_metrics("cpu_percent", days=30)
forecast = tfm.forecast([cpu_history], freq=[0])[0]
threshold = forecast.mean() + 2 * forecast.std()

Guidelines

  • Provide at least 3x the forecast horizon as history (forecasting 30 days? give 90+ days history)
  • TimesFM works best on data with clear patterns (seasonality, trends)
  • For noisy data, smooth with rolling average before feeding to the model
  • Compare against a naive baseline (last period's values) to validate improvement
  • The model runs on CPU; GPU speeds up batch processing of many series

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/terminalskills-skills-timesfm/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

terminalskills-skills-timesfm.ocm.jsonjson
{
  "ocm": "1",
  "id": "terminalskills-skills-timesfm",
  "kind": "skill",
  "name": "timesfm",
  "description": "Forecast time series data using Google's TimesFM foundation model with zero-shot prediction. Use when: forecasting sales or demand, predicting server metrics, financial time series analysis, anomaly detection without training custom models.",
  "publisher": "terminalskills",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "forecasting",
      "time-series",
      "google-research",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Forecast time series data using Google's TimesFM foundation model with zero-shot prediction. Use when: forecasting sales or demand, predicting server metrics, financial time series analysis, anomaly detection without training custom models."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/terminalskills/skills",
      "path": "skills/timesfm/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/terminalskills/skills/blob/HEAD/skills/timesfm/SKILL.md",
      "key": "terminalskills/skills/skills/timesfm/SKILL.md"
    },
    "compatibility": "Python 3.10+, PyTorch",
    "license": "Apache-2.0"
  },
  "instructions": "# TimesFM\n\n## Overview\n\nTimesFM is a 200M-parameter foundation model by Google Research, pretrained on 100 billion real-world time points. It performs zero-shot forecasting across domains — no fine-tuning required. Feed it historical data, get predictions immediately.\n\n## Instructions\n\n### Installation\n\n```bash\npip install timesfm\n```\n\n### Basic Forecasting\n\n```python\nimport timesfm\nimport numpy as np\n\n# Initialize model\ntfm = timesfm.TimesFm(\n    hparams=timesfm.TimesFmHparams(\n        per_core_batch_size=32,\n        horizon_len=30,\n    ),\n    checkpoint=timesfm.TimesFmCheckpoint(\n        hug",
  "cost": {
    "context_tokens": 610
  }
}

Fetch it by URL: GET /api/v1/registry/terminalskills-skills-timesfm/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.