Math-Models / README.md
leonli66's picture
Add files using upload-large-folder tool
50f0269 verified
|
Raw
History Blame Contribute Delete
2.73 kB
---
license: mit
library_name: transformers
pipeline_tag: text-generation
tags:
- text-generation
- olmo2
- safetensors
- math
- reasoning
- pretraining
- sft
- rl
- grpo
---
# Math-Models
Checkpoints from a **pretraining β†’ post-training** study on a **1B-parameter OLMo-2**
model trained on math. The repo bundles, for 15 pretraining anchors, the model at
every stage of the pipeline:
**pretrain β†’ anneal β†’ SFT β†’ RL**
so you can compare how the amount of pretraining changes what post-training can add.
## Structure
Each folder is one **pretraining anchor** (a stable pretraining checkpoint at
`step{N}`, β‰ˆ `N Γ— 2.097M` tokens). Inside it, one subfolder per stage:
```
step{N}/
β”œβ”€β”€ pretrain/ # stable pretraining snapshot @ step N
β”œβ”€β”€ anneal/ # LR-annealed from the pretrain snapshot
β”œβ”€β”€ sft/ # SFT (NuminaMath) on top of the anneal
└── rl/
β”œβ”€β”€ step100/ # GRPO RL (DeepScaleR), every 100 steps ...
β”œβ”€β”€ step200/
└── ... up to step3000
```
Every leaf is a self-contained, ready-to-load HF model in **bf16 safetensors**
(weights + tokenizer only β€” no optimizer state or training logs).
| Anchor | Pretrain tokens | Anchor | Pretrain tokens |
|---|---|---|---|
| `step5000` | 10.5B | `step45000` | 94.4B |
| `step10000` | 21.0B | `step50000` | 104.9B |
| `step15000` | 31.5B | `step60000` | 125.8B |
| `step20000` | 41.9B | `step70000` | 146.8B |
| `step25000` | 52.4B | `step80000` | 167.8B |
| `step30000` | 62.9B | `step90000` | 188.7B |
| `step35000` | 73.4B | `step95368` | 200.0B (final) |
| `step40000` | 83.9B | | |
## Loading
The models use the standard **OLMo-2** architecture, so `transformers` loads them
directly β€” no `trust_remote_code`. Point `from_pretrained` at the subfolder you want.
If you don't want to clone the whole repo (it's large), snapshot just one leaf:
```python
from huggingface_hub import snapshot_download
from transformers import AutoModelForCausalLM, AutoTokenizer
path = snapshot_download(
"pre-to-post-olmo/Math-Models",
allow_patterns="step20000/sft/*",
local_dir="Math-Models",
)
model = AutoModelForCausalLM.from_pretrained(f"{path}/step20000/sft")
tok = AutoTokenizer.from_pretrained(f"{path}/step20000/sft")
```
## Generating a rollout
A `generate.py` at the repo root wraps the load + chat-template + decode:
```bash
python generate.py --model step20000/sft --prompt "What is 12 * 13?"
python generate.py --model step95368/rl/step3000 --prompt "..." --max-new-tokens 1024
```
`pretrain/` and `anneal/` are base LMs (no chat template); `sft/` and `rl/` are
chat-tuned and expect the chat template (applied automatically by `generate.py`).