Forecasting time series with Mistral's Timestral
I came across Timestral, a family of time series models that Mistral released this month, and wanted to see it run on my Mac. It does zero-shot forecasting: you hand it the history of a series it has never seen, and it forecasts what comes next, with a range around each value, without any training on that series. It comes in four sizes, from 5 million to 209 million parameters, and Mistral says it doesn't need a GPU.
Running it on my Mac
My Mac has an M1 Pro with 32 GB of memory, which holds even the largest size easily: its weights are 837 MB. Mistral's timestral Python package downloads the weights from Hugging Face and runs them with PyTorch. It all happens on the CPU, because the package does some of its arithmetic in 64-bit floats, which PyTorch can't do on Apple's GPU. The CPU turned out to be plenty: the largest size forecasts those two years of airline passengers in about 125 ms.
Then I made a small browser app to look at the forecasts. It shows a series, forecasts it from a point partway through, and lays the real values that came after over the forecast, so you can see how close it got. I loaded four real series and five made-up ones. The app, and the scripts that made the forecasts below, are in my timestral repository.
Try it
Pick a dataset, then move Forecast from along the series. Pick a size to shade its range, or expand the panel to fill the window. Every forecast here was made ahead of time on my Mac, so the page only shows them.
The made-up series are there to poke at it. The random walk has nothing to predict, and the shading fans out to say so. The level shift jumps at hour 1,200, so a forecast from before the jump can't see it coming.