Tafsut
Tafsut forecasts nine quantiles for each future time step, from the 10th to the 90th percentile. Version 0.2.0 adds three forecasting backbones and a covariate adapter that also works with forecasts from other models. Existing code using the public legacy checkpoint can keep using the same model loader and forecast function.
Install
Requires Python 3.10 or newer.
python -m pip install --upgrade tafsut
For plots, install python -m pip install "tafsut[visualization]". For CUDA inference, use a PyTorch build compatible with your GPU.
Make a forecast
This example runs on CPU with Tafsut-GIFT. Use Tafsut-FM/tafsut-legacy to reproduce a forecast with the original model.
import torch
from tafsut import TafsutModel, forecast
model = TafsutModel.from_pretrained("Tafsut-FM/tafsut-gift", device="cpu")
history = torch.tensor([19., 21., 20., float("nan"), 24., 23.])
prediction = forecast(model, history, horizon=24)
print(prediction.shape) # (1, 24, 9)
median = prediction[0, :, 4]
Pass one series or a batch shaped (batch, time). Mark missing observations with NaN or supply a boolean context_mask. The result is a CPU tensor shaped (batch, horizon, 9) in the original units.
Checkpoints in 0.2.0
The Tafsut collection contains the four new checkpoints. All four can be loaded by Hub ID without signing in. Both loaders also accept a local checkpoint directory.
| Hugging Face model ID | Use |
|---|---|
Tafsut-FM/tafsut-gift |
Target-only forecasting with the backbone adapted for GIFT-Eval. |
Tafsut-FM/tafsut-fev |
Target-only forecasting with the backbone adapted for FEV-Bench. |
Tafsut-FM/tafsut-synth |
Target-only forecasting with a backbone and quantile head trained on synthetic series. |
Tafsut-FM/tafsut-adapter |
Refine a base forecast using past or known-future covariates. |
The three backbones accept up to 32,768 history steps and forecast up to 1,024 steps per pass. The adapter uses the latest 8,192 history steps and accepts up to 16 covariates.
Add a covariate
Load the FEV backbone and adapter on the same device. Calendar features such as day of week are available for both the history and the forecast horizon.
from tafsut import TafsutAdapter
backbone = TafsutModel.from_pretrained("Tafsut-FM/tafsut-fev", device="cpu")
adapter = TafsutAdapter.from_pretrained("Tafsut-FM/tafsut-adapter", device="cpu")
day = torch.arange(history.numel() + 24).remainder(7).float()
covariates = {
"past_covariates": day[:history.numel()],
"future_covariates": day[history.numel():],
}
refined = forecast(backbone, history, horizon=24, adapter=adapter, **covariates)
To use another backbone, pass its target-only quantiles in original units. For example, the GIFT forecast above can be refined with the same calendar feature.
refined_gift = adapter.refine(
history, prediction,
quantile_levels=[i / 10 for i in range(1, 10)],
**covariates,
)
Supply all nine deciles for learned quantile spacing, or q0.1, q0.5 and q0.9 for interpolation between refined anchors.
Command line
tafsut-forecast --model Tafsut-FM/tafsut-gift --context 19,21,20,24,23 --horizon 24 --device cpu
The command prints a JSON forecast. Omit --model inside a checkpoint directory to load its weights. In other directories the default is Tafsut-GIFT. Use tafsut-forecast --help for file inputs, covariates, and plotting options.
Metadata
Release files for tafsut 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tafsut-0.2.0.tar.gz | 1.2 MB | Without provenance | Details for tafsut-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tafsut-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for tafsut-0.2.0-py3-none-any.whl |
Total release size: 1.2 MB
Release files / tafsut-0.2.0.tar.gz
| Download URL | tafsut-0.2.0.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37096e9e8e0d00e796a976a2d1f5ba9c4987e9241d4a387ab4500a614be04f64
|
|
BLAKE2b-256 checksum How to use checksums |
920b5a1411118f143c84d76361f743d7e3fe7f6d21643821872f282bc4709f7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / tafsut-0.2.0-py3-none-any.whl
| Download URL | tafsut-0.2.0-py3-none-any.whl |
|---|---|
| Size | 36.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a303c20c6bb82309507789c099735e8d7cc0f13a3b5a2b98cb4e950638f818e8
|
|
BLAKE2b-256 checksum How to use checksums |
14659fcb92a8a14e60dc636ec245da65aadf435d8cd1104229e5e41f1dc76235
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for tafsut 0.2.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.