Instructions to use amazon/chronos-t5-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Chronos
How to use amazon/chronos-t5-large with Chronos:
pip install chronos-forecasting
import pandas as pd from chronos import BaseChronosPipeline pipeline = BaseChronosPipeline.from_pretrained("amazon/chronos-t5-large", 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
index out of range in self
Hi I successfully used the code below to load the model in sagemaker studio.
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("amazon/chronos-t5-large")
model = AutoModelForSeq2SeqLM.from_pretrained("amazon/chronos-t5-large")
Next, I attempted to perform model inference using the following code:
input_text = "100,200,150,300"
inputs=tokenizer(input_text, return_tensors ="pt", padding=True, truncation=True)
outputs = model.generate(**inputs)
However, I encountered the following error: index out of range in self. Could anyone provide guidance on how to resolve this issue?
In addition, I want to do time series prediction on sales data. How to do model inference using tokenizer?
Thank you!
@Sssma This is not the right way to use the models as they don't support text input. Please check the README on our Github repo.