Skip to main content

tstokenizers

Time series tokenizer for autoregressive modeling. Converts multivariate time series into text, then trains a BPE tokenizer on it. Based on the FAST method by Physical Intelligence.

Installation

pip install tstokenizers

Usage

Serialize a DataFrame into text. Its row count must be a multiple of patch_len.

from tstokenizers import Serializer
import numpy as np
import pandas as pd

df = pd.DataFrame({
    'sin': np.sin(np.linspace(0, 10, 128)),
    'cos': np.cos(np.linspace(0, 10, 128)),
})
quantiles = df.quantile([0.01, 0.99])

serializer = Serializer(quantiles, patch_len=8, quant_scale=100)
text = serializer.encode(df)
df_decoded = serializer.decode(text)
patch_text_len = serializer.patch_text_len()

Train a BPE tokenizer on a Hugging Face dataset with a text column:

tstokenizers-train --dataset-path=path --output-path=path --vocab-size=1024

Encode text into token ids:

from transformers import AutoTokenizer
from tstokenizers import Processor

processor = Processor(AutoTokenizer.from_pretrained(path))
token_ids = processor.encode(text, patch_text_len)

Citation

This package applies the FAST approach to time series:

Pertsch et al., "FAST: Efficient Action Tokenization for Vision-Language-Action Models", 2025. https://arxiv.org/abs/2501.09747

License

Apache 2.0

Metadata

Release files for tstokenizers 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tstokenizers 0.1.0
File Size Uploaded Provenance Actions
tstokenizers-0.1.0.tar.gz 11.8 kB Without provenance Details for tstokenizers-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tstokenizers 0.1.0
File Interpreter ABI Platform Actions
tstokenizers-0.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for tstokenizers-0.1.0-py2.py3-none-any.whl

Total release size: 24.9 kB

Release files / tstokenizers-0.1.0.tar.gz

Download URL tstokenizers-0.1.0.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2285a50fab33106d3042acfcdb56048b6c70aadeedd246f1631ff78b699b9b7d
BLAKE2b-256 checksum
How to use checksums
43de635fd23fd26bbfb76bf3ee786680f293919a489c7aaa48072d9c394b87df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release files / tstokenizers-0.1.0-py2.py3-none-any.whl

Download URL tstokenizers-0.1.0-py2.py3-none-any.whl
Size 13.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1db2ff9296252563b798987a2818d138bee7f8825fe1a10dde8258478e8ffe5f
BLAKE2b-256 checksum
How to use checksums
608d6f7d79a7d8dfbf1bbedb92e246173d2cfdf3760eda75feb6401527181c05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Security for tstokenizers 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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