Fix standalone runtime usage in model card
Browse files
checkpoints/checkpoint-01B/README.md
CHANGED
|
@@ -7,7 +7,6 @@ tags:
|
|
| 7 |
- gated-deltanet
|
| 8 |
- gdn2
|
| 9 |
- kaczmarz
|
| 10 |
-
- litgpt
|
| 11 |
datasets:
|
| 12 |
- HuggingFaceFW/fineweb-edu
|
| 13 |
---
|
|
@@ -43,15 +42,13 @@ or SWA layers.
|
|
| 43 |
|
| 44 |
## License
|
| 45 |
|
| 46 |
-
The
|
| 47 |
-
under Apache-2.0 by the Gated_Linear_Attention2 authors.
|
| 48 |
|
| 49 |
-
The
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
implementation or obtain the required upstream permission.
|
| 55 |
|
| 56 |
## Training Setup
|
| 57 |
|
|
@@ -70,46 +67,27 @@ implementation or obtain the required upstream permission.
|
|
| 70 |
|
| 71 |
Each `checkpoints/checkpoint-XXB/` folder contains:
|
| 72 |
|
| 73 |
-
- `model-ckpt.pth`:
|
| 74 |
- `training_metadata.json`: run metadata and model config
|
| 75 |
- `README.md`: this model card snapshot
|
| 76 |
|
| 77 |
This is not loadable with `transformers.AutoModelForCausalLM.from_pretrained`.
|
| 78 |
|
| 79 |
-
## Loading Sketch
|
| 80 |
-
|
| 81 |
-
Use the code from the training repository:
|
| 82 |
-
|
| 83 |
-
```python
|
| 84 |
-
import torch
|
| 85 |
-
from lit_gpt.config import Config
|
| 86 |
-
from lit_gpt.model import GPT
|
| 87 |
-
|
| 88 |
-
config = Config.from_name("gdn2_kla_1.3B", block_size=4096)
|
| 89 |
-
model = GPT(config)
|
| 90 |
-
checkpoint = torch.load("model-ckpt.pth", map_location="cpu")
|
| 91 |
-
model.load_state_dict(checkpoint["model"], strict=False)
|
| 92 |
-
model.eval()
|
| 93 |
-
```
|
| 94 |
-
|
| 95 |
-
Depending on the Fabric/FSDP save format, production loading may require the
|
| 96 |
-
same Lightning Fabric stack used for training.
|
| 97 |
-
|
| 98 |
## How To Use
|
| 99 |
|
| 100 |
This is a causal language model: given a text prefix, it predicts the next token
|
| 101 |
and can continue the text autoregressively. It was pretrained on FineWeb-Edu and
|
| 102 |
is not instruction-tuned, RLHF-tuned, or chat-aligned.
|
| 103 |
|
| 104 |
-
The checkpoint is a
|
| 105 |
-
`transformers.AutoModelForCausalLM` checkpoint. Use the
|
| 106 |
-
load it.
|
| 107 |
|
| 108 |
Install and clone:
|
| 109 |
|
| 110 |
```bash
|
| 111 |
git clone https://github.com/gyunggyung/Gated_Linear_Attention2
|
| 112 |
-
cd Gated_Linear_Attention2
|
| 113 |
pip install -e .
|
| 114 |
```
|
| 115 |
|
|
@@ -125,7 +103,7 @@ repo_id = "gyung/Gated_Linear_Attention2"
|
|
| 125 |
checkpoint_file = "checkpoints/checkpoint-01B/model-ckpt.pth"
|
| 126 |
|
| 127 |
if not torch.cuda.is_available():
|
| 128 |
-
raise RuntimeError("
|
| 129 |
|
| 130 |
device = "cuda"
|
| 131 |
dtype = torch.bfloat16
|
|
@@ -154,8 +132,8 @@ next_token_id = int(torch.argmax(logits, dim=-1)[0])
|
|
| 154 |
print(tokenizer.decode([next_token_id]))
|
| 155 |
```
|
| 156 |
|
| 157 |
-
The standalone runtime uses
|
| 158 |
-
memory does not grow with generated token length.
|
| 159 |
|
| 160 |
## Evaluation Plan
|
| 161 |
|
|
|
|
| 7 |
- gated-deltanet
|
| 8 |
- gdn2
|
| 9 |
- kaczmarz
|
|
|
|
| 10 |
datasets:
|
| 11 |
- HuggingFaceFW/fineweb-edu
|
| 12 |
---
|
|
|
|
| 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 |
|
|
|
|
| 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 |
|
|
|
|
| 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
|
|
|
|
| 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 |
|