Views
No views yet


| Model | Tokenizer | Context length | Param | Hugging Face Model Card |
|---|---|---|---|---|
| Kronos-mini | Kronos-Tokenizer-2k | 2048 | 4.1M | ✅ NeoQuasar/Kronos-mini |
| Kronos-small | Kronos-Tokenizer-base | 512 | 24.7M | ✅ NeoQuasar/Kronos-small |
| Kronos-base | Kronos-Tokenizer-base | 512 | 102.3M | ✅ NeoQuasar/Kronos-base |
| Kronos-large | Kronos-Tokenizer-base | 512 | 499.2M | ❌ Not yet publicly available |
KronosPredictor class. It handles data preprocessing, normalization, prediction, and inverse normalization, allowing you to get from raw data to forecasts in just a few lines of code.max_context for Kronos-small and Kronos-base is 512. This is the maximum sequence length the model can process. For optimal performance, it is recommended that your input data length (i.e., lookback) does not exceed this limit. The KronosPredictor will automatically handle truncation for longer contexts.requirements.txt:pip install -r requirements.txt1from model import Kronos, KronosTokenizer, KronosPredictor
2
3# Load from Hugging Face Hub
4tokenizer = KronosTokenizer.from_pretrained("NeoQuasar/Kronos-Tokenizer-base")
5model = Kronos.from_pretrained("NeoQuasar/Kronos-small")KronosPredictor, passing the model, tokenizer, and desired device.1# Initialize the predictor
2predictor = KronosPredictor(model, tokenizer, device="cuda:0", max_context=512)predict method requires three main inputs:df: A pandas DataFrame containing the historical K-line data. It must include columns ['open', 'high', 'low', 'close']. volume and amount are optional.x_timestamp: A pandas Series of timestamps corresponding to the historical data in df.y_timestamp: A pandas Series of timestamps for the future periods you want to predict.1import pandas as pd
2
3# Load your data (example data can be found in the GitHub repo)
4df = pd.read_csv("./data/XSHG_5min_600977.csv")
5df['timestamps'] = pd.to_datetime(df['timestamps'])
6
7# Define context window and prediction length
8lookback = 400
9pred_len = 120
10
11# Prepare inputs for the predictor
12x_df = df.loc[:lookback-1, ['open', 'high', 'low', 'close', 'volume', 'amount']]
13x_timestamp = df.loc[:lookback-1, 'timestamps']
14y_timestamp = df.loc[lookback:lookback+pred_len-1, 'timestamps']predict method to generate forecasts. You can control the sampling process with parameters like T, top_p, and sample_count for probabilistic forecasting.1# Generate predictions
2pred_df = predictor.predict(
3 df=x_df,
4 x_timestamp=x_timestamp,
5 y_timestamp=y_timestamp,
6 pred_len=pred_len,
7 T=1.0, # Temperature for sampling
8 top_p=0.9, # Nucleus sampling probability
9 sample_count=1 # Number of forecast paths to generate and average
10)
11
12print("Forecasted Data Head:")
13print(pred_df.head())predict method returns a pandas DataFrame containing the forecasted values for open, high, low, close, volume, and amount, indexed by the y_timestamp you provided.examples/prediction_example.py in the GitHub repository.
examples/prediction_wo_vol_example.py.1@misc{shi2025kronos,
2 title={Kronos: A Foundation Model for the Language of Financial Markets},
3 author={Yu Shi and Zongliang Fu and Shuo Chen and Bohan Zhao and Wei Xu and Changshui Zhang and Jian Li},
4 year={2025},
5 eprint={2508.02739},
6 archivePrefix={arXiv},
7 primaryClass={q-fin.ST},
8 url={https://arxiv.org/abs/2508.02739},
9}