Time Series Forecasting
MLX
Safetensors
apple-silicon
timestral
time-series
forecasting
quantile-regression
Instructions to use jbilcke/timestral-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use jbilcke/timestral-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download jbilcke/timestral-mlx --local-dir timestral-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
File size: 2,377 Bytes
d35e174 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | """Release integrity, local loading, metadata exclusions and wheel checks."""
import importlib.util
import json
from pathlib import Path
import shutil
import zipfile
import numpy as np
import pytest
from timestral_mlx import TimestralForecaster
ROOT=Path(__file__).resolve().parents[1]
def test_local_bundle_roundtrip_and_corruption(tmp_path):
source=ROOT/'models'/'5M'
if not source.exists(): pytest.skip('convert 5M first')
for name in ('config.json','model.safetensors','LICENSE','manifest.json'):
shutil.copyfile(source/name,tmp_path/name)
fc=TimestralForecaster.from_pretrained(tmp_path)
assert fc.forecast(np.arange(65,dtype=np.float32),9).quantiles.shape==(1,1,9,21)
with (tmp_path/'model.safetensors').open('r+b') as f:
f.seek(-1,2); byte=f.read(1); f.seek(-1,2); f.write(bytes([byte[0]^1]))
with pytest.raises(ValueError,match='integrity'):
TimestralForecaster.from_pretrained(tmp_path)
def test_variant_mismatch():
source=ROOT/'models'/'5M'
if not source.exists(): pytest.skip('convert 5M first')
with pytest.raises(ValueError,match='variant'):
TimestralForecaster.from_pretrained(source.parent,variant='not-a-model')
def test_apple_metadata_exclusions():
spec=importlib.util.spec_from_file_location('package_release',ROOT/'scripts'/'package_release.py')
module=importlib.util.module_from_spec(spec);spec.loader.exec_module(module)
for name in ('._README.md','5M/._model.safetensors','__MACOSX/foo','x/.DS_Store','x/a.pyc','x/a.tmp','x/.AppleDouble/README'):
assert module.excluded(name),name
for name in ('5M/model.safetensors','timestral_mlx/model.py','LICENSE-WEIGHTS'):
assert not module.excluded(name),name
def test_installable_wheel_inventory():
wheels=[p for p in (ROOT/'dist').glob('*.whl') if not p.name.startswith('._')]
if not wheels: pytest.skip('build wheel first')
with zipfile.ZipFile(wheels[0]) as z:
assert not any(any(p.startswith('._') or p in {'.DS_Store','__MACOSX'} for p in n.split('/')) for n in z.namelist())
for path in (ROOT/'timestral_mlx').glob('*.py'):
if not path.name.startswith('._'):
assert z.read('timestral_mlx/'+path.name)==path.read_bytes()
assert z.read('timestral_mlx-0.1.0.dist-info/licenses/LICENSE-WEIGHTS')==(ROOT/'LICENSE-WEIGHTS').read_bytes()
|