Release final SimpleHC weights and inference configuration
Browse files- README.md +65 -0
- model.safetensors +3 -0
- model_config.json +68 -0
- tokenizer.tiktoken.json +0 -0
README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: pytorch
|
| 3 |
+
tags:
|
| 4 |
+
- nexttransformer
|
| 5 |
+
- residual
|
| 6 |
+
- causal-lm
|
| 7 |
+
- pretrained
|
| 8 |
+
- safetensors
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# NextTransformer SimpleHC
|
| 13 |
+
|
| 14 |
+
Four residual streams with identity transitions, full-state read/write gates, and gate inputs shared over four sublayers.
|
| 15 |
+
|
| 16 |
+
This is the final SimpleHC checkpoint in the NextTransformer 49.152B-token architecture comparison. It has 1,358,072,020 parameters and a 2,048-token context. The model was pretrained on ClimbMix for 46,875 updates. The 49B in the repository name refers to training tokens.
|
| 17 |
+
|
| 18 |
+
| Final evaluation | Result |
|
| 19 |
+
|---|---:|
|
| 20 |
+
| Validation BPB | 0.6628 |
|
| 21 |
+
| CORE-22 (×100) | 35.11 |
|
| 22 |
+
|
| 23 |
+
[Architecture](https://github.com/Interactive-Active-AI/NextTransformer/blob/7232973c7b3a55d19b0271091ab6129ed1c2bd76/results/methods/simplehc.json) · [Run record](https://github.com/Interactive-Active-AI/NextTransformer/blob/7232973c7b3a55d19b0271091ab6129ed1c2bd76/results/runs/simplehc.json)
|
| 24 |
+
|
| 25 |
+
## Load the weights
|
| 26 |
+
|
| 27 |
+
Install the tested NextTransformer implementation and the safetensors reader in a Python 3.10–3.13 environment.
|
| 28 |
+
|
| 29 |
+
```bash
|
| 30 |
+
pip install "nexttransformer @ git+https://github.com/Interactive-Active-AI/NextTransformer.git@7232973c7b3a55d19b0271091ab6129ed1c2bd76" safetensors
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
The example encodes a prompt with the checkpoint's tokenizer and prints its most likely next token.
|
| 34 |
+
|
| 35 |
+
```python
|
| 36 |
+
import base64
|
| 37 |
+
import json
|
| 38 |
+
from pathlib import Path
|
| 39 |
+
|
| 40 |
+
import tiktoken
|
| 41 |
+
import torch
|
| 42 |
+
from huggingface_hub import snapshot_download
|
| 43 |
+
from safetensors.torch import load_file
|
| 44 |
+
from nexttransformer.models import build_model, config_from_dict
|
| 45 |
+
|
| 46 |
+
root = Path(snapshot_download("NextTransformer/SimpleHC-49B-Tokens"))
|
| 47 |
+
config = config_from_dict(json.loads((root / "model_config.json").read_text()))
|
| 48 |
+
model = build_model(config, device="cpu")
|
| 49 |
+
model.load_state_dict(load_file(root / "model.safetensors"), strict=True)
|
| 50 |
+
if hasattr(model, "set_step"):
|
| 51 |
+
model.set_step(46875)
|
| 52 |
+
model.eval()
|
| 53 |
+
|
| 54 |
+
spec = json.loads((root / "tokenizer.tiktoken.json").read_text())
|
| 55 |
+
encoding = tiktoken.Encoding(
|
| 56 |
+
name=spec["name"],
|
| 57 |
+
pat_str=spec["pat_str"],
|
| 58 |
+
mergeable_ranks={base64.b64decode(b): rank for b, rank in spec["mergeable_ranks"]},
|
| 59 |
+
special_tokens=spec["special_tokens"],
|
| 60 |
+
)
|
| 61 |
+
prompt = [encoding.encode_single_token("<|bos|>")] + encoding.encode_ordinary("The sky is")
|
| 62 |
+
with torch.inference_mode():
|
| 63 |
+
logits = model(torch.tensor([prompt]))
|
| 64 |
+
print(encoding.decode([int(logits[0, -1].argmax())]))
|
| 65 |
+
```
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5a75c8670c21867619dbf4cf418a1b9bebfb1d0f8cec92412498feb05e56fa84
|
| 3 |
+
size 4123686960
|
model_config.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"method": "simplehc",
|
| 3 |
+
"width": 1536,
|
| 4 |
+
"heads": 12,
|
| 5 |
+
"vocab_size": 32768,
|
| 6 |
+
"sequence_len": 2048,
|
| 7 |
+
"mlp_width": 6144,
|
| 8 |
+
"layers": 23,
|
| 9 |
+
"pre_layers": 3,
|
| 10 |
+
"core_layers": 9,
|
| 11 |
+
"post_layers": 3,
|
| 12 |
+
"loops": 2,
|
| 13 |
+
"window_pattern": "L",
|
| 14 |
+
"max_loops": 3,
|
| 15 |
+
"act_epsilon": 0.01,
|
| 16 |
+
"ponder_weight": 0.01,
|
| 17 |
+
"huginn_mean": 3.0,
|
| 18 |
+
"huginn_sigma": 0.5,
|
| 19 |
+
"huginn_backprop_loops": 2,
|
| 20 |
+
"routing_seed": 1729,
|
| 21 |
+
"eval_loops": 3,
|
| 22 |
+
"ouro_entropy_weight": 0.1,
|
| 23 |
+
"ouro_gate_steps": 1024,
|
| 24 |
+
"ouro_exit_quantile": 0.5,
|
| 25 |
+
"sparse_topk": 256,
|
| 26 |
+
"block_size": 128,
|
| 27 |
+
"compression_size": 4,
|
| 28 |
+
"local_window": 512,
|
| 29 |
+
"index_heads": 4,
|
| 30 |
+
"index_dim": 128,
|
| 31 |
+
"index_rope_dim": 64,
|
| 32 |
+
"index_loss_weight": 1.0,
|
| 33 |
+
"burnin_steps": 512,
|
| 34 |
+
"slots": 64,
|
| 35 |
+
"gate_rank": 16,
|
| 36 |
+
"conv_size": 4,
|
| 37 |
+
"reference_chunk": 32,
|
| 38 |
+
"backend": "reference",
|
| 39 |
+
"scale": "formal",
|
| 40 |
+
"residual_streams": 4,
|
| 41 |
+
"residual_gate_init": 0.01,
|
| 42 |
+
"sinkhorn_iterations": 20,
|
| 43 |
+
"attnres_groups": 8,
|
| 44 |
+
"sliding_window": 2048,
|
| 45 |
+
"q_rank": 768,
|
| 46 |
+
"kv_rank": 256,
|
| 47 |
+
"qk_nope_dim": 64,
|
| 48 |
+
"qk_rope_dim": 64,
|
| 49 |
+
"v_head_dim": 128,
|
| 50 |
+
"options": [
|
| 51 |
+
[
|
| 52 |
+
"alpha_init",
|
| 53 |
+
0.01
|
| 54 |
+
],
|
| 55 |
+
[
|
| 56 |
+
"group",
|
| 57 |
+
4
|
| 58 |
+
],
|
| 59 |
+
[
|
| 60 |
+
"init_std",
|
| 61 |
+
0.006
|
| 62 |
+
],
|
| 63 |
+
[
|
| 64 |
+
"streams",
|
| 65 |
+
4
|
| 66 |
+
]
|
| 67 |
+
]
|
| 68 |
+
}
|
tokenizer.tiktoken.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|