Skip to content

Set up the environment, weights, and data ​

After finishing this section, your computer will have: KiT's code, a Python environment that can use your GPU, the official 1.1GB weights, and 1.2GB of demo data. The last command will print cuda True.

Before you start ​

  • An NVIDIA GPU with the driver installed (you can see the GPU by running nvidia-smi in the terminal)
  • conda installed (Miniconda is enough) and git
  • Access to GitHub and Hugging Face

1. Clone the code ​

bash
git clone https://github.com/Luciferbobo/KiT.git
cd KiT

All subsequent commands should be run inside the KiT directory.

2. Create the conda environment ​

The official README's approach:

bash
conda create -n kit python=3.13 -y
conda activate kit

If you get a CondaToSNonInteractiveError

Newer versions of conda (we used 26.1.1) require you to accept Anaconda's Terms of Service the first time you use the default channel; otherwise you get this error. Pick one of two options:

  • Run conda tos accept as the error message suggests, accept the terms, and try again;
  • Skip the default channel and use the community conda-forge instead:
bash
conda create -n kit -c conda-forge --override-channels python=3.13 -y

We used the second option.

3. Install PyTorch and dependencies ​

bash
pip install "torch>=2.4" --index-url https://download.pytorch.org/whl/cu118
pip install -r requirements.txt

cu118 is the CUDA version, which also works with newer GPUs and drivers; the official README notes you can switch it as needed. requirements.txt contains numpy, pandas, pyarrow, matplotlib (for plotting), and akshare (used only during backtesting to download the CSI 500 index).

Verify:

bash
python -c "import torch;print('torch',torch.__version__,'cuda',torch.cuda.is_available())"

You should see something like:

text
torch 2.7.1+cu118 cuda True

We did a fresh install following the steps above; it took 2 minutes 33 seconds, with the bulk being the 905MB PyTorch.

If you see cuda False: PyTorch was installed as the CPU version, or the driver isn't set up. First confirm that nvidia-smi works, then reinstall with the command above that includes --index-url.

4. Download the weights and demo data ​

bash
pip install huggingface_hub
hf download Lucifer744/KiT_model --local-dir ckpt/
hf download Lucifer744/KiT_data_demo --local-dir data/ --repo-type dataset

The README says huggingface-cli

The official README uses huggingface-cli download …. The huggingface_hub 2.4.0 we freshly installed in 2026/11 only ships the hf command, without huggingface-cli; the arguments are the same, so just swap the command name.

The second command downloads two checkpoints, about 1.1GB each. If you only want the one used in the paper:

bash
hf download Lucifer744/KiT_model --include "config.json" "step_market_284M/*" --local-dir ckpt/

The demo data is about 1.2GB (of which the 1-minute bars are 811MB), 705 files in total; our download took 2 minutes.

5. Put the weights where the scripts can find them ​

The downloaded weights are at ckpt/step_market_284M/step_market_284M.pt, while the prediction script looks for ckpt/step_market_284M.pt by default. Two options:

  • Pass an argument on every run: --ckpt ckpt/step_market_284M/step_market_284M.pt
  • Or create a link so you never have to worry about it again:
bash
ln -s step_market_284M/step_market_284M.pt ckpt/step_market_284M.pt

On Windows there is no ln, so use the first option.

Check the directory:

bash
ls ckpt/step_market_284M data data/ashare

You should see:

text
ckpt/step_market_284M:
instruments.json  stats.json  step_market_284M.pt

data:
ashare  instruments.json  README.md  stats.json  trade_dates.csv

data/ashare:
15m  1d  1h  1m  2h  30m  5m

Under data/ashare there are seven folders, each containing 100 .parquet files, one per stock.

Quiz timeAfter downloading the weights, the prediction script reports checkpoint not found. What's the most likely cause?

Do a quick check ​

  • torch.cuda.is_available() prints True
  • ckpt/step_market_284M.pt exists (file or link)
  • data/ashare contains folders for 7 granularities

Next section: First forecast.

gaodong.aiAboutPrivacyContact

Independent tutorials, not affiliated with any product mentioned. Product names and trademarks belong to their owners. Check official pages for prices and policies.