teddyoas commited on
Commit
2b8a10c
·
verified ·
1 Parent(s): 60214aa

checkpoint at step 100

Browse files
README.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mathcode-llm
2
+
3
+ A decoder-only transformer language model **built from scratch** -- no
4
+ pretrained weights, no `transformers` model classes. Every layer (RMSNorm,
5
+ RoPE, grouped-query attention, SwiGLU, KV-cached decoding) is hand-written
6
+ PyTorch in `model/transformer.py`, and the BPE tokenizer was trained from
7
+ scratch on our own corpus.
8
+
9
+ ## Training data
10
+
11
+ | Source | Share |
12
+ |---|---|
13
+ | `open-web-math` (arXiv papers, Math StackExchange) | 50.2% |
14
+ | `codeparrot-clean` (Python from GitHub) | 37.7% |
15
+ | `code-search-net` (Python / JS / Go / Java functions) | 5.8% |
16
+ | `verifiable-coding-problems-python` | 4.8% |
17
+ | **The Nature of Code** (Daniel Shiffman, full 13 chapters) | 1.4% |
18
+
19
+ 600 M training tokens, interleaved at 4096-token granularity so the domain
20
+ mixture stays stable throughout training.
21
+
22
+ ## Architecture
23
+
24
+ | | |
25
+ |---|---|
26
+ | Parameters | ~110 M (85 M non-embedding) |
27
+ | Layers / heads / width | 12 / 12 / 768 |
28
+ | Context length | 1024 tokens |
29
+ | Vocabulary | 32,768 (byte-level BPE, trained from scratch) |
30
+ | Normalisation | RMSNorm (pre-norm) |
31
+ | Position | RoPE |
32
+ | FFN | SwiGLU |
33
+ | Attention | multi-head, KV cache for fast sampling |
34
+ | Embeddings | tied |
35
+
36
+ ## Usage
37
+
38
+ ```python
39
+ from transformers import AutoTokenizer, AutoModelForCausalLM
40
+
41
+ tok = AutoTokenizer.from_pretrained("teddyoas/mathcode-llm")
42
+ model = AutoModelForCausalLM.from_pretrained("teddyoas/mathcode-llm")
43
+ ```
44
+
45
+ The tokenizer is a `PreTrainedTokenizerFast` built with the `tokenizers`
46
+ library, so `AutoTokenizer` loads it directly.
47
+
48
+ ## Resuming training
49
+
50
+ `checkpoint/latest.pt` holds the model, the optimiser state, the AMP scaler,
51
+ the step counter and the token counter:
52
+
53
+ ```bash
54
+ python train.py --config configs/mathcode.yaml \
55
+ --resume checkpoint/latest.pt
56
+ ```
57
+
58
+ ## Status
59
+
60
+ Training checkpoint: **step 100 / ?**
61
+ (13,107,200 tokens seen, val loss inf)
checkpoint/latest.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11f3d39acb9a1f6203cae3fb1d18266a96faf681cb1c83ae3edf37209d37c486
3
+ size 1321524875
config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "vocab_size": 32768,
3
+ "n_layer": 12,
4
+ "n_head": 12,
5
+ "n_embd": 768,
6
+ "n_kv_head": 12,
7
+ "block_size": 1024,
8
+ "dropout": 0.0,
9
+ "rope_theta": 10000.0,
10
+ "tie_weights": true,
11
+ "use_swiglu": true,
12
+ "norm_eps": 1e-05,
13
+ "init_std": 0.02
14
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:390e71cd986fec558d058865da32464ab743bcd2a6731033c66df8eba23d83ca
3
+ size 440485848
model_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "vocab_size": 32768,
3
+ "n_layer": 12,
4
+ "n_head": 12,
5
+ "n_embd": 768,
6
+ "n_kv_head": 12,
7
+ "block_size": 1024,
8
+ "dropout": 0.0,
9
+ "rope_theta": 10000.0,
10
+ "tie_weights": true,
11
+ "use_swiglu": true,
12
+ "norm_eps": 1e-05,
13
+ "init_std": 0.02
14
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "tokenizer_class": "PreTrainedTokenizerFast",
3
+ "eos_token": "",
4
+ "bos_token": "",
5
+ "unk_token": null,
6
+ "model_max_length": 1024
7
+ }