Instructions to use amazon/chronos-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Chronos
How to use amazon/chronos-2 with Chronos:
pip install chronos-forecasting
import pandas as pd from chronos import BaseChronosPipeline pipeline = BaseChronosPipeline.from_pretrained("amazon/chronos-2", device_map="cuda") # Load historical data context_df = pd.read_csv("https://autogluon.s3.us-west-2.amazonaws.com/datasets/timeseries/misc/AirPassengers.csv") # Generate predictions pred_df = pipeline.predict_df( context_df, prediction_length=36, # Number of steps to forecast quantile_levels=[0.1, 0.5, 0.9], # Quantiles for probabilistic forecast id_column="item_id", # Column identifying different time series timestamp_column="Month", # Column with datetime information target="#Passengers", # Column(s) with time series values to predict ) - Notebooks
- Google Colab
- Kaggle
Empty-history inputs return ±1e5 quantiles (fix in weights + repro)
Hi, I found that Chronos-2 returns extreme quantiles when the context is entirely NaN, e.g. a 10–90% range of −142,000 to +131,000. It shows up in GIFT-Eval's Bitbrains tasks, where servers that were off for the whole context window come back during the forecast. Repro and a suggested one-line code fix are in amazon-science/chronos-forecasting#544.
As an experiment I also fixed it in the weights: 1,536 weights in block 11's MLP (one previously dead neuron), with outputs bit-identical whenever the context has two or more real values. It's here if useful: lawrencehui/chronos-2-empty-history-fix. Bitbrains CRPS improves up to 33%, nothing else changes.
The code fix is the right one upstream. Thanks for open-sourcing the model.