Skip to main content

Multimodal extension for time series foundation models

Project description

TSFMx

TSFMx (TSFMx Standardizes Fusion of Multimodal exogenous features) is a framework for extending TSFMs (including TimesFM and Chronos) with multimodal inputs such as text.

Installation

pip install tsfmx[all]

Quick Start

1. Setup

Clone the Time-MMD dataset:

./scripts/clone_time_mmd.sh

Split the dataset into train / val / test:

PYTHONPATH=. uv run python scripts/split_time_mmd_datasets.py \
    --train-ratio 0.6 \
    --val-ratio 0.2

2. Pre-compute Text Embeddings

TimesFM:

PYTHONPATH=. uv run python scripts/cache_time_mmd_datasets.py \
    --model-config examples/time_mmd/configs/models/timesfm.yml \
    --text-encoder-type english
PYTHONPATH=. uv run python scripts/cache_time_mmd_datasets.py \
    --model-config examples/time_mmd/configs/models/timesfm.yml \
    --text-encoder-type english --augment

Chronos:

PYTHONPATH=. uv run python scripts/cache_time_mmd_datasets.py \
    --model-config examples/time_mmd/configs/models/chronos.yml \
    --text-encoder-type english
PYTHONPATH=. uv run python scripts/cache_time_mmd_datasets.py \
    --model-config examples/time_mmd/configs/models/chronos.yml \
    --text-encoder-type english --augment

3. Fusion Hyperparameter Tuning

Run a W&B Sweeps search for the fusion mode (adapter frozen, fusion layer trained):

TimesFM:

PYTHONPATH=. uv run python scripts/tune_time_mmd_fusion_sweep.py \
    --model-config examples/time_mmd/configs/models/timesfm.yml \
    --sweep-config examples/time_mmd/configs/sweeps/fusion_1layer.yml \
    --best-checkpoint-path outputs/sweeps/fusion/best_fusion_timesfm.pt

Chronos:

PYTHONPATH=. uv run python scripts/tune_time_mmd_fusion_sweep.py \
    --model-config examples/time_mmd/configs/models/chronos.yml \
    --sweep-config examples/time_mmd/configs/sweeps/fusion_1layer.yml \
    --best-checkpoint-path outputs/sweeps/fusion/best_fusion_chronos.pt

To run the adapter mode (adapter fine-tuned, no fusion):

TimesFM:

PYTHONPATH=. uv run python scripts/tune_time_mmd_adapter_sweep.py \
    --model-config examples/time_mmd/configs/models/timesfm.yml \
    --sweep-config examples/time_mmd/configs/sweeps/adapter.yml

Chronos:

PYTHONPATH=. uv run python scripts/tune_time_mmd_adapter_sweep.py \
    --model-config examples/time_mmd/configs/models/chronos.yml \
    --sweep-config examples/time_mmd/configs/sweeps/adapter.yml

4. Fine-tune Hyperparameter Tuning

After fusion tuning, run a W&B Sweeps search for the finetune mode (adapter + fusion trained jointly), starting from the best fusion checkpoint:

TimesFM:

PYTHONPATH=. uv run python scripts/tune_time_mmd_finetune_sweep.py \
    --model-config examples/time_mmd/configs/models/timesfm.yml \
    --sweep-config examples/time_mmd/configs/sweeps/finetune_1layer.yml \
    --fusion-checkpoint-path outputs/sweeps/fusion/best_fusion_timesfm.pt

Chronos:

PYTHONPATH=. uv run python scripts/tune_time_mmd_finetune_sweep.py \
    --model-config examples/time_mmd/configs/models/chronos.yml \
    --sweep-config examples/time_mmd/configs/sweeps/finetune_1layer.yml \
    --fusion-checkpoint-path outputs/sweeps/fusion/best_fusion_chronos.pt

Acknowledgments

We thank the Time-MMD team for providing the multimodal time series dataset used in our examples and experiments.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tsfmx-1.2.0.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tsfmx-1.2.0-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file tsfmx-1.2.0.tar.gz.

File metadata

  • Download URL: tsfmx-1.2.0.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for tsfmx-1.2.0.tar.gz
Algorithm Hash digest
SHA256 d03422c59d196355301e5c717aa48388326170f2445e2b504f407610fdade222
MD5 2e17b0c04091d28bf10d7d3f2cf57a95
BLAKE2b-256 7cce6b54cb364339e68dcbcc1140f80affb4a4321b471c918b7c50dff1bcd44a

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsfmx-1.2.0.tar.gz:

Publisher: publish-to-pypi.yml on himura467/tsfmx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tsfmx-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: tsfmx-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for tsfmx-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 88a60df54e0e317e63d2d16724e1754c830e85977cca913041d7e75f958a6726
MD5 359c6167d70d930d3d6851f23b0c4cff
BLAKE2b-256 b3cd92ed0f9a95ad3ef11d943cea3308b1c76f16173d0a6c0d3e2b4da45117a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsfmx-1.2.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on himura467/tsfmx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page