|
Download README.md from NextTransformer/GDN-49B-Tokens: direct link, hf CLI and curl.
- Browser
- Download file 2.7 kB
-
https://huggingface.co/NextTransformer/GDN-49B-Tokens/resolve/main/README.md
- Command line
-
hf download hf://NextTransformer/GDN-49B-Tokens/README.md
-
curl -L -o README.md https://huggingface.co/NextTransformer/GDN-49B-Tokens/resolve/main/README.md
2.7 kB
| library_name: pytorch | |
| pipeline_tag: text-generation | |
| tags: | |
| - nexttransformer | |
| - linear-attention | |
| - causal-lm | |
| - pretrained | |
| - safetensors | |
| # NextTransformer GDN | |
| This is the final GDN checkpoint (method `gdn`) from the NextTransformer 49.152B-token comparison. It has 1,411,349,680 parameters and a 2,048-token context. Pretraining used ClimbMix for 46,875 updates at seed 42. | |
| Shrink the memory with one gate per head, then correct it. | |
| | Final evaluation | Result | | |
| |---|---:| | |
| | Validation BPB | 0.6673 | | |
| | CORE-22 (×100) | 30.55 | | |
| Validation BPB was measured on 20,971,520 tokens in a separate evaluation of the final checkpoint. CORE-22 is the mean of the 22 centered task scores. | |
| [Architecture](https://github.com/Interactive-Active-AI/NextTransformer/blob/1cc58931aa9db7fd258c982a41d6adcd697bb45b/results/methods/gdn.json) · [Run record](https://github.com/Interactive-Active-AI/NextTransformer/blob/1cc58931aa9db7fd258c982a41d6adcd697bb45b/results/runs/gdn.json) · [Checkpoint audit](https://github.com/Interactive-Active-AI/NextTransformer/blob/1cc58931aa9db7fd258c982a41d6adcd697bb45b/evidence/audits/gdn.json) | |
| ## Load the weights | |
| Install the pinned NextTransformer implementation and the safetensors reader with Python 3.10–3.13. | |
| ```bash | |
| pip install "nexttransformer @ git+https://github.com/Interactive-Active-AI/NextTransformer.git@1cc58931aa9db7fd258c982a41d6adcd697bb45b" safetensors | |
| ``` | |
| The example uses the PyTorch reference recurrence on CPU. The saved model configuration records the fused recurrence used in training. | |
| ```python | |
| import base64 | |
| import json | |
| import os | |
| from pathlib import Path | |
| os.environ["CUDA_VISIBLE_DEVICES"] = "" | |
| import tiktoken | |
| import torch | |
| from huggingface_hub import snapshot_download | |
| from safetensors.torch import load_file | |
| from nexttransformer.models import build_model, config_from_dict | |
| root = Path(snapshot_download("NextTransformer/GDN-49B-Tokens")) | |
| raw = json.loads((root / "model_config.json").read_text()) | |
| config = config_from_dict({**raw, "backend": "reference"}) | |
| model = build_model(config, device="cpu") | |
| model.load_state_dict(load_file(root / "model.safetensors"), strict=True) | |
| model.set_step(46875) | |
| model.eval() | |
| spec = json.loads((root / "tokenizer.tiktoken.json").read_text()) | |
| encoding = tiktoken.Encoding( | |
| name=spec["name"], | |
| pat_str=spec["pat_str"], | |
| mergeable_ranks={base64.b64decode(b): rank for b, rank in spec["mergeable_ranks"]}, | |
| special_tokens=spec["special_tokens"], | |
| ) | |
| prompt = [encoding.encode_single_token("<|bos|>")] + encoding.encode_ordinary("The sky is") | |
| with torch.inference_mode(): | |
| logits = model(torch.tensor([prompt])) | |
| print(encoding.decode([int(logits[0, -1].argmax())])) | |
| ``` | |