Overview
In order to be generally applicable to many time series datasets, the pretrained Granite-TimeSeries model is trained in a channel independent way. Under channel independence, the model learns a common dynamics model across all channels without considering interactions. In many cases, there is important information in a time series dataset related to how different channels interact with each other. In order to capture these dependencies, we need to fine tune and enable channel mixing in the decoder. The fine-tuning process requires the following steps:- Load and prepare data using the time series preprocessor. Since we are fine-tuning the model, we have more options to include things like cross-channel interactions, exogenous features and categorical values.
- Load the model and freeze the backbone
- Create a Hugging Face Trainer and train the model
- Evaluate the model
Prerequisites
Please make sure your python environment is properly set up. The code snippets below are illustrative examples of how various components work with our Granite-TimeSeries models, and require the installation of the Granite TSFM library. Please see the setup instructions.Data loading
Pandas dataframes are required in the preprocessing and forecasting pipeline components. We simply read the csv into a pandas dataframe, making sure to format the timestamp column properly.Data preparation
In the zero-shot case, we can only handle datasets with id columns and one or more target columns, advanced use cases involving exogenous or categorical features are not yet supported. In the fine-tuning case, we are free to specify additional columns, like control_columns. We first specify the parameters of the preprocessor, enabling scaling (normalization) of the data. Then we use the preprocessor to extract train, validation, and test datasets from the original data.Loading the pretrained granite time series model
Here we load the model usingfrom_pretrained
but pass some extra configuration
arguments. Note the presence of “decoder_mode” and the other index related
arguments. The TimeSeriesPreprocessor provides some helper functions to make
passing these parameters easier.