Release final weights and inference configuration
Browse files- README.md +65 -0
- model.safetensors +3 -0
- model_config.json +44 -0
- tokenizer.tiktoken.json +0 -0
README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: pytorch
|
| 3 |
+
tags:
|
| 4 |
+
- nexttransformer
|
| 5 |
+
- others
|
| 6 |
+
- causal-lm
|
| 7 |
+
- pretrained
|
| 8 |
+
- safetensors
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# NextTransformer SSSL
|
| 13 |
+
|
| 14 |
+
Short, short, short, long. The historical reference.
|
| 15 |
+
|
| 16 |
+
This is the final SSSL checkpoint in the NextTransformer 49.152B-token architecture comparison. It has 1,384,122,122 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.6671 |
|
| 21 |
+
| CORE-22 (×100) | 33.78 |
|
| 22 |
+
|
| 23 |
+
[Architecture](https://github.com/Interactive-Active-AI/NextTransformer/blob/2358425b56ce6a320fc042f67fd0a32294b5e0d7/results/methods/sssl.json) · [Run record](https://github.com/Interactive-Active-AI/NextTransformer/blob/2358425b56ce6a320fc042f67fd0a32294b5e0d7/results/runs/sssl.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@2358425b56ce6a320fc042f67fd0a32294b5e0d7" 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/SSSL-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:9dfa66cd94cf3d4de4973b4e67cc639f4390c7216e8b974114fa6bcafbe3f8a1
|
| 3 |
+
size 4227884608
|
model_config.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architecture": "dense",
|
| 3 |
+
"dense_layers": 24,
|
| 4 |
+
"pre_layers": 3,
|
| 5 |
+
"core_layers": 9,
|
| 6 |
+
"post_layers": 3,
|
| 7 |
+
"recursions": 1,
|
| 8 |
+
"activation_checkpointing": false,
|
| 9 |
+
"fourier_dim": 256,
|
| 10 |
+
"loop_modulation_bound": 0.5,
|
| 11 |
+
"loop_condition_lr_multiplier": 0.5,
|
| 12 |
+
"loop_condition_grad_clip": 1.0,
|
| 13 |
+
"vocab_size": 32768,
|
| 14 |
+
"sequence_len": 2048,
|
| 15 |
+
"width": 1536,
|
| 16 |
+
"heads": 12,
|
| 17 |
+
"mlp_width": 6144,
|
| 18 |
+
"window_pattern": "SSSL",
|
| 19 |
+
"circle_max_steps": 27,
|
| 20 |
+
"circle_target_steps": 17.5,
|
| 21 |
+
"circle_method": "sparse_gate",
|
| 22 |
+
"circle_budget_mode": "mean_survival",
|
| 23 |
+
"circle_halter": "delta_depth",
|
| 24 |
+
"circle_halter_eps": 1e-06,
|
| 25 |
+
"circle_exit_interval": 1,
|
| 26 |
+
"circle_threshold": 0.5,
|
| 27 |
+
"circle_routing_seed": 1729,
|
| 28 |
+
"circle_budget_beta": 0.9,
|
| 29 |
+
"circle_random_warmup": 256,
|
| 30 |
+
"circle_route_transition": 768,
|
| 31 |
+
"circle_depth_rho": 1.0,
|
| 32 |
+
"circle_shape_weight": 0.1,
|
| 33 |
+
"circle_dual_lr": 0.05,
|
| 34 |
+
"circle_dual_limit": 2.0,
|
| 35 |
+
"circle_halter_lr_multiplier": 0.5,
|
| 36 |
+
"circle_halter_grad_clip": 1.0,
|
| 37 |
+
"mor_target_survival": [
|
| 38 |
+
0.64,
|
| 39 |
+
0.32
|
| 40 |
+
],
|
| 41 |
+
"mor_budget_strength": 1.0,
|
| 42 |
+
"mor_dual_lr": 0.05,
|
| 43 |
+
"mor_dual_limit": 10.0
|
| 44 |
+
}
|
tokenizer.tiktoken.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|