Instructions to use amazon/chronos-bolt-tiny with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Chronos
How to use amazon/chronos-bolt-tiny with Chronos:
pip install chronos-forecasting
import pandas as pd from chronos import BaseChronosPipeline pipeline = BaseChronosPipeline.from_pretrained("amazon/chronos-bolt-tiny", 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
ImportError: cannot import name 'BaseChronosPipeline' from 'chronos'
Description:
I am trying to use the Chronos time series model in my Jupyter notebook. I installed the chronos package and attempted to load the pipeline as shown in the Hugging Face documentation:
import chronos
pipeline = chronos.BaseChronosPipeline.from_pretrained(
"amazon/chronos-bolt-tiny",
device_map="cuda", # use "cpu" for CPU inference and "mps" for Apple Silicon
torch_dtype=torch.bfloat16,
)
However, I get the following error:
ImportError: cannot import name 'BaseChronosPipeline' from 'chronos' (c:\Users\rohit\AppData\Local\Programs\Python\Python313\Lib\site-packages\chronos_init_.py)
When I check dir(chronos), I only see the default Python module attributes and not BaseChronosPipeline.
I also tried installing chronos-timeseries but pip could not find the package.
Questions:
Is there a different package I should be installing?
Has the API changed, or is there a different way to load the Chronos pipeline?
What is the correct way to use Chronos for time series forecasting with Hugging Face?
Environment:
Python 3.13.0
Windows 10
Installed chronos via pip
Thank you for your help!