496
stars
44
commits
Jupyter Notebook
primary language
Jul 22, 2024
updated
π WebsiteΒ Β | ποΈ DatasetsΒ Β | Β Β π Dataset Technical Report Β Β
π€ Hugging FaceΒ Β | Β Β π€ Blog postΒ Β | Β Β π₯οΈ Demo
This repository contains the training and inference code needed to replicate our winning solution to the AI Mathematical Olympiad - Progress Prize 1.
Our solution consisted of four main components:
We used a mix of open-source libraries to train our models, notably TRL, PyTorch, vLLM, and DeepSpeed. On one node of 8 x H100 GPUs, our models took 10 hours to train. You can find the datasets and models on the Hugging Face Hub under the NuminaMath collection.
This project is simple by design and mostly consists of:
training: scripts to fine-tune and quantize models.kaggle-solution: a notebook with the SC-TIR inference code we used during Kaggle submissions.To run the code in this project, first, create a Python virtual environment using e.g. Conda:
conda create -n aimo python=3.10 && conda activate aimo
Next, install PyTorch v2.1.2 - the precise version is important for reproducibility! Since this is hardware-dependent, we direct you to the PyTorch Installation Page.
You can then install the remaining package dependencies as follows:
pip install -r requirements.txt
You will also need Flash Attention 2 installed, which can be done by running:
python -m pip install flash-attn --no-build-isolation
Note: If your machine has less than 96GB of RAM and many CPU cores, reduce the MAX_JOBS arguments, e.g. MAX_JOBS=4 pip install flash-attn --no-build-isolation
Next, log into your Hugging Face account as follows:
huggingface-cli login
Finally, install Git LFS so that you can push models to the Hugging Face Hub:
sudo apt-get install git-lfs
Training is conducted in two stages, following the MuMath-Code recipe:
We used two datasets to fine-tune our model:
As described above, training the model proceeds in two steps:
NuminaMath-CoT dataset. The result is an SFT model like NuminaMath-7B-CoT.NuminaMath-TIR dataset. The result is a "reasoning agent" like NuminaMath-7B-TIR.See below for commands to train these models using DeepSpeed ZeRO-3. Note you will require 8 GPUs with 80GB of VRAM to train the full model with our settings.
accelerate launch --config_file=training/configs/deepspeed_zero3.yaml training/sft.py training/configs/stage-1-cot.yaml
accelerate launch --config_file=training/configs/deepspeed_zero3.yaml training/sft.py training/configs/stage-2-tir.yaml
Once the model has been trained, we quantized it to 8-bit precision with AutoGPTQ in order to improve performance with vLLM on Kaggle's T4 GPUs (as they do not support bfloat16 types). This step is optional and the model should have better performance when loaded in 16-bit precision:
python training/quantization.py --model_id AI-MO/NuminaMath-7B-TIR --calibration_dataset data/NuminaMath-TIR
aimo-progress-prize/
βββ LICENSE
βββ README.md <- The top-level README for developers using this project
βββ images
βββ kaggle-solution.ipynb <- Notebook with inference code used in our Kaggle submissions
βββ requirements.txt <- Project dependencies
βββ training
βββ configs <- Hyperparameter configs for training
βββ numina <- Source code for use in this project
βββ quantization.py <- Script to quantize model with AutoGPTQ
βββ sft.py <- Script to fine-tune our models
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
One node of 8 x H100s, each with 80GB VRAM and 96 CPUs with 1TB RAM.
requirements.txt):@misc{numina_math_datasets,
author = {Jia LI, Edward Beeching, Lewis Tunstall, Ben Lipkin, Roman Soletskyi, Shengyi Costa Huang, Kashif Rasul, Longhui Yu, Albert Jiang, Ziju Shen, Zihan Qin, Bin Dong, Li Zhou, Yann Fleureau, Guillaume Lample, and Stanislas Polu},
title = {NuminaMath},
year = {2024},
publisher = {Numina},
journal = {GitHub repository},
howpublished = {\url{[https://github.com/project-numina/aimo-progress-prize](https://github.com/project-numina/aimo-progress-prize/blob/main/report/numina_dataset.pdf)}}
}
Jupyter Notebook
88.7%
Python
11.3%
496
stars
44
commits
Jupyter Notebook
primary language
Jul 22, 2024
updated
π WebsiteΒ Β | ποΈ DatasetsΒ Β | Β Β π Dataset Technical Report Β Β
π€ Hugging FaceΒ Β | Β Β π€ Blog postΒ Β | Β Β π₯οΈ Demo
This repository contains the training and inference code needed to replicate our winning solution to the AI Mathematical Olympiad - Progress Prize 1.
Our solution consisted of four main components:
We used a mix of open-source libraries to train our models, notably TRL, PyTorch, vLLM, and DeepSpeed. On one node of 8 x H100 GPUs, our models took 10 hours to train. You can find the datasets and models on the Hugging Face Hub under the NuminaMath collection.
This project is simple by design and mostly consists of:
training: scripts to fine-tune and quantize models.kaggle-solution: a notebook with the SC-TIR inference code we used during Kaggle submissions.To run the code in this project, first, create a Python virtual environment using e.g. Conda:
conda create -n aimo python=3.10 && conda activate aimo
Next, install PyTorch v2.1.2 - the precise version is important for reproducibility! Since this is hardware-dependent, we direct you to the PyTorch Installation Page.
You can then install the remaining package dependencies as follows:
pip install -r requirements.txt
You will also need Flash Attention 2 installed, which can be done by running:
python -m pip install flash-attn --no-build-isolation
Note: If your machine has less than 96GB of RAM and many CPU cores, reduce the MAX_JOBS arguments, e.g. MAX_JOBS=4 pip install flash-attn --no-build-isolation
Next, log into your Hugging Face account as follows:
huggingface-cli login
Finally, install Git LFS so that you can push models to the Hugging Face Hub:
sudo apt-get install git-lfs
Training is conducted in two stages, following the MuMath-Code recipe:
We used two datasets to fine-tune our model:
As described above, training the model proceeds in two steps:
NuminaMath-CoT dataset. The result is an SFT model like NuminaMath-7B-CoT.NuminaMath-TIR dataset. The result is a "reasoning agent" like NuminaMath-7B-TIR.See below for commands to train these models using DeepSpeed ZeRO-3. Note you will require 8 GPUs with 80GB of VRAM to train the full model with our settings.
accelerate launch --config_file=training/configs/deepspeed_zero3.yaml training/sft.py training/configs/stage-1-cot.yaml
accelerate launch --config_file=training/configs/deepspeed_zero3.yaml training/sft.py training/configs/stage-2-tir.yaml
Once the model has been trained, we quantized it to 8-bit precision with AutoGPTQ in order to improve performance with vLLM on Kaggle's T4 GPUs (as they do not support bfloat16 types). This step is optional and the model should have better performance when loaded in 16-bit precision:
python training/quantization.py --model_id AI-MO/NuminaMath-7B-TIR --calibration_dataset data/NuminaMath-TIR
aimo-progress-prize/
βββ LICENSE
βββ README.md <- The top-level README for developers using this project
βββ images
βββ kaggle-solution.ipynb <- Notebook with inference code used in our Kaggle submissions
βββ requirements.txt <- Project dependencies
βββ training
βββ configs <- Hyperparameter configs for training
βββ numina <- Source code for use in this project
βββ quantization.py <- Script to quantize model with AutoGPTQ
βββ sft.py <- Script to fine-tune our models
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
One node of 8 x H100s, each with 80GB VRAM and 96 CPUs with 1TB RAM.
requirements.txt):@misc{numina_math_datasets,
author = {Jia LI, Edward Beeching, Lewis Tunstall, Ben Lipkin, Roman Soletskyi, Shengyi Costa Huang, Kashif Rasul, Longhui Yu, Albert Jiang, Ziju Shen, Zihan Qin, Bin Dong, Li Zhou, Yann Fleureau, Guillaume Lample, and Stanislas Polu},
title = {NuminaMath},
year = {2024},
publisher = {Numina},
journal = {GitHub repository},
howpublished = {\url{[https://github.com/project-numina/aimo-progress-prize](https://github.com/project-numina/aimo-progress-prize/blob/main/report/numina_dataset.pdf)}}
}
Jupyter Notebook
88.7%
Python
11.3%