gyung commited on
Commit
532abd0
·
verified ·
1 Parent(s): 0f9483c

Upload checkpoints/checkpoint-09B

Browse files
checkpoints/checkpoint-09B/README.md ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: pytorch
4
+ tags:
5
+ - linear-attention
6
+ - recurrent
7
+ - gated-deltanet
8
+ - gdn2
9
+ - kaczmarz
10
+ datasets:
11
+ - HuggingFaceFW/fineweb-edu
12
+ ---
13
+
14
+ # Gated_Linear_Attention2
15
+
16
+ This repository stores milestone checkpoints for `gdn2_kla_1.3B` from the
17
+ `gdn2_kla_1.3B_fineweb_edu_10bt` run.
18
+
19
+ ## What This Model Is
20
+
21
+ `gdn2_kla_1.3B` is a recurrent-only linear attention experiment. It starts from
22
+ Gated DeltaNet-2 and folds a Kaczmarz-style key-norm-normalized update step into
23
+ the separate erase and write gates:
24
+
25
+ ```math
26
+ \lambda_t = \frac{\eta_t}{\|k_t\|_2^2 + \epsilon}
27
+ ```
28
+
29
+ ```math
30
+ S_t =
31
+ \left(I - k_t(\lambda_t b_t \odot k_t)^\top\right)D_tS_{t-1}
32
+ +
33
+ k_t(\lambda_t w_t \odot v_t)^\top
34
+ ```
35
+
36
+ It is not a standard Transformers checkpoint and does not use softmax attention
37
+ or SWA layers.
38
+
39
+ ## Code
40
+
41
+ - GitHub: https://github.com/gyunggyung/Gated_Linear_Attention2
42
+
43
+ ## License
44
+
45
+ The model weights in this Hugging Face repository are released under Apache-2.0.
46
+
47
+ The standalone inference runtime linked above is also Apache-2.0. It does not
48
+ import `lit_gpt`, `fla`, or the NVIDIA GatedDeltaNet-2 Triton kernels. The
49
+ training code used during experimentation may contain NVIDIA GatedDeltaNet-2
50
+ derived components under `Nvidia Source Code License-NC`, but this Hugging Face
51
+ model repository is intended to be used with the standalone Apache-2.0 runtime.
52
+
53
+ ## Training Setup
54
+
55
+ - Base architecture: recurrent-only GDN-2, 1.3B scale
56
+ - Candidate: Kaczmarz-normalized GDN-2 gates
57
+ - Training data source: FineWeb-Edu `sample/100BT` local parquet
58
+ - Token budget for this run: 10B
59
+ - Current milestone: 9,000,000,000 tokens
60
+ - Sequence length: 4096 tokens
61
+ - Global batch tokens: 1,048,576
62
+ - Tokenizer: `TinyLlama/TinyLlama_v1.1`
63
+ - Data shuffle seed: `3407`
64
+ - Data shuffle buffer: `100000`
65
+
66
+ ## Checkpoint Format
67
+
68
+ Each `checkpoints/checkpoint-XXB/` folder contains:
69
+
70
+ - `model-ckpt.pth`: PyTorch model-only checkpoint
71
+ - `training_metadata.json`: run metadata and model config
72
+ - `README.md`: this model card snapshot
73
+
74
+ This is not loadable with `transformers.AutoModelForCausalLM.from_pretrained`.
75
+
76
+ ## How To Use
77
+
78
+ This is a causal language model: given a text prefix, it predicts the next token
79
+ and can continue the text autoregressively. It was pretrained on FineWeb-Edu and
80
+ is not instruction-tuned, RLHF-tuned, or chat-aligned.
81
+
82
+ The checkpoint is a PyTorch `.pth` checkpoint, not a
83
+ `transformers.AutoModelForCausalLM` checkpoint. Use the standalone runtime below
84
+ to load it.
85
+
86
+ Install and clone:
87
+
88
+ ```bash
89
+ git clone https://github.com/gyunggyung/Gated_Linear_Attention2
90
+ cd Gated_Linear_Attention2
91
+ pip install -e .
92
+ ```
93
+
94
+ Minimal text-generation example:
95
+
96
+ ```python
97
+ import torch
98
+
99
+ from gated_linear_attention2 import GatedLinearAttention2ForCausalLM, load_tokenizer
100
+ from gated_linear_attention2.generation import generate
101
+
102
+ repo_id = "gyung/Gated_Linear_Attention2"
103
+ checkpoint_file = "checkpoints/checkpoint-01B/model-ckpt.pth"
104
+
105
+ if not torch.cuda.is_available():
106
+ raise RuntimeError("CUDA is recommended for this 1.3B checkpoint; CPU will be very slow.")
107
+
108
+ device = "cuda"
109
+ dtype = torch.bfloat16
110
+
111
+ model = GatedLinearAttention2ForCausalLM.from_hf(
112
+ repo_id=repo_id,
113
+ checkpoint=checkpoint_file,
114
+ device=device,
115
+ dtype=dtype,
116
+ )
117
+ tokenizer = load_tokenizer(repo_id, subfolder="tokenizer")
118
+
119
+ prompt = "Artificial intelligence can help education by"
120
+ print(generate(model, tokenizer, prompt, max_new_tokens=80, temperature=0.8, top_k=50))
121
+ ```
122
+
123
+ For next-token scoring instead of generation, run one forward pass and inspect
124
+ the final-position logits:
125
+
126
+ ```python
127
+ prompt = "The capital of France is"
128
+ input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
129
+ with torch.no_grad():
130
+ logits = model(input_ids)[:, -1, :]
131
+ next_token_id = int(torch.argmax(logits, dim=-1)[0])
132
+ print(tokenizer.decode([next_token_id]))
133
+ ```
134
+
135
+ The standalone runtime uses a recurrent state cache during generation, so decode
136
+ memory does not grow with generated token length like a Transformer KV cache.
137
+
138
+ ## Evaluation Plan
139
+
140
+ Compare against the plain `gdn2_1.3B` baseline on the GDN-2 paper tasks:
141
+
142
+ - WikiText and LAMBADA perplexity
143
+ - LAMBADA and commonsense zero-shot accuracy
144
+ - RULER S-NIAH and MK-NIAH
145
+ - Real-world retrieval tasks: SWDE, SQuAD, FDA, TriviaQA, NQ, DROP
146
+
147
+ The 10B run is an ablation, not a claim that it replaces the published 100B
148
+ GDN-2 model.
checkpoints/checkpoint-09B/model-ckpt.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f45f1278f4ee24590e23d595401c722370751a170e7668bfca0f086115c6215e
3
+ size 5803237212
checkpoints/checkpoint-09B/training_metadata.json ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "checkpoint_format": "LitGPT/Fabric .pth, not a Transformers AutoModel checkpoint",
3
+ "data_shuffle_buffer": 100000,
4
+ "data_shuffle_seed": 3407,
5
+ "data_source": "HuggingFaceFW/fineweb-edu sample/100BT local parquet",
6
+ "experiment_name": "gdn2_kla_1.3B_fineweb_edu_10bt",
7
+ "global_batch_tokens": 1048576,
8
+ "learning_rate": 0.0004,
9
+ "milestone_index": 9,
10
+ "model_config": {
11
+ "_mlp_class": "LLaMAMLP",
12
+ "_norm_class": "FusedRMSNorm",
13
+ "activation_checkpointing": true,
14
+ "bias": false,
15
+ "block_size": 4096,
16
+ "condense_ratio": 1,
17
+ "gdn2_allow_neg_eigval": false,
18
+ "gdn2_conv_bias": false,
19
+ "gdn2_conv_size": 4,
20
+ "gdn2_expand_v": 1.0,
21
+ "gdn2_head_dim": 128,
22
+ "gdn2_kaczmarz_eps": 1e-06,
23
+ "gdn2_mode": "chunk",
24
+ "gdn2_num_heads": 16,
25
+ "gdn2_num_v_heads": null,
26
+ "gdn2_per_layer": 1,
27
+ "gdn2_use_kaczmarz_step": true,
28
+ "gdn2_use_qk_l2norm_in_kernel": false,
29
+ "gdn2_use_short_conv": true,
30
+ "intermediate_size": 6208,
31
+ "local_window": 2048,
32
+ "mamba_init": true,
33
+ "mlp": true,
34
+ "n_embd": 2304,
35
+ "n_head": 18,
36
+ "n_layer": 18,
37
+ "n_query_groups": 18,
38
+ "name": "gdn2_kla_1.3B",
39
+ "nope": true,
40
+ "norm_eps": 1e-05,
41
+ "org": "NVIDIA",
42
+ "padded_vocab_size": 32000,
43
+ "padding_multiple": 64,
44
+ "parallel_residual": false,
45
+ "rotary_percentage": 1.0,
46
+ "shared_attention_norm": false,
47
+ "vocab_size": 32000
48
+ },
49
+ "model_name": "gdn2_kla_1.3B",
50
+ "seed": 3407,
51
+ "sequence_length": 4096,
52
+ "tokenizer_name": "TinyLlama/TinyLlama_v1.1",
53
+ "tokenizer_path": "",
54
+ "train_config": "tsz128x4k_10B",
55
+ "trained_tokens": 9000000000,
56
+ "weight_decay": 0.1
57
+ }