Model card — step 30000, PPL 3.65
Browse files
README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
tags:
|
| 5 |
+
- causal-lm
|
| 6 |
+
- code
|
| 7 |
+
- python
|
| 8 |
+
- pretrain
|
| 9 |
+
base_model: gpt2
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# code-1b-pretrain-v3
|
| 13 |
+
|
| 14 |
+
A 1.13B parameter GPT-2 architecture causal language model pretrained from
|
| 15 |
+
scratch on a curated mix of Python code and programming literature.
|
| 16 |
+
|
| 17 |
+
## Usage
|
| 18 |
+
|
| 19 |
+
```python
|
| 20 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 21 |
+
|
| 22 |
+
tokenizer = AutoTokenizer.from_pretrained("rovdetection/code-1b-pretrain-v3")
|
| 23 |
+
model = AutoModelForCausalLM.from_pretrained("rovdetection/code-1b-pretrain-v3")
|
| 24 |
+
|
| 25 |
+
inputs = tokenizer("def fibonacci(n):", return_tensors="pt")
|
| 26 |
+
out = model.generate(**inputs, max_new_tokens=100, temperature=0.8, do_sample=True)
|
| 27 |
+
print(tokenizer.decode(out[0], skip_special_tokens=True))
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
## Training summary
|
| 31 |
+
|
| 32 |
+
| | |
|
| 33 |
+
|---|---|
|
| 34 |
+
| Architecture | GPT-2 (1.13B params) |
|
| 35 |
+
| Total steps | 30,000 |
|
| 36 |
+
| Peak LR | 3e-5 (cosine with warmup) |
|
| 37 |
+
| Effective batch size | 32 (gradient accumulation) |
|
| 38 |
+
| Precision | fp16 + 8-bit Adam (bitsandbytes) |
|
| 39 |
+
| Eval perplexity (held-out Python) | **3.65** |
|
| 40 |
+
|
| 41 |
+
## Dataset mix (Phase 4 — final 7k steps)
|
| 42 |
+
|
| 43 |
+
| Dataset | Weight |
|
| 44 |
+
|---|---|
|
| 45 |
+
| bigcode/starcoderdata (Python) | 35% |
|
| 46 |
+
| codeparrot/codeparrot-clean | 25% |
|
| 47 |
+
| open-phi/programming_books_llama | 25% |
|
| 48 |
+
| greengerong/leetcode | 15% |
|
| 49 |
+
|
| 50 |
+
## Training phases
|
| 51 |
+
|
| 52 |
+
| Phase | Steps | LR range | Notes |
|
| 53 |
+
|---|---|---|---|
|
| 54 |
+
| 1 | 0 – 10,000 | 0 → 3e-5 | Warmup + early descent |
|
| 55 |
+
| 2–3 | 10,000 – 23,000 | 3e-5 → 4e-6 | Cosine decay, baseline mix |
|
| 56 |
+
| 4 | 23,000 – 30,000 | 4e-6 → ~0 | Quality shift: StarCoder ↑35% |
|
| 57 |
+
|
| 58 |
+
## Repo structure
|
| 59 |
+
|
| 60 |
+
The repo root contains inference weights only (`model.safetensors`, tokenizer,
|
| 61 |
+
`config.json`). The `last-checkpoint/` subfolder contains the full training
|
| 62 |
+
state (optimizer, scheduler, scaler, RNG) for resuming training.
|