Views
No views yet
tuned-lens package (Muon-optimizer fork) on 262M tokens of
HuggingFaceFW/fineweb-edu (1000 outer steps, 262144 tokens/step, bf16
precision, H100).alunxu/qwen-2.5-7b-tuned-lens-105M (wikitext-103 105M).
The larger FineWeb-Edu training corpus gives lower per-layer
reconstruction loss across the early/mid layers, which matters when the
lens is read off non-encyclopedic prompts (instruction-following, MASK,
ETHICS-style framings).1from huggingface_hub import snapshot_download
2import json
3import torch
4from tuned_lens import TunedLens
5from tuned_lens.nn.lenses import TunedLensConfig
6from tuned_lens.nn.unembed import Unembed
7from transformers import AutoModelForCausalLM
8
9model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-7B",
10 torch_dtype=torch.bfloat16,
11 device_map="cuda")
12lens_dir = snapshot_download("alunxu/qwen-2.5-7b-tuned-lens-fwedu-262M")
13with open(f"{lens_dir}/config.json") as f:
14 cfg = TunedLensConfig.from_dict(json.load(f))
15lens = TunedLens(Unembed(model), cfg)
16state = torch.load(f"{lens_dir}/params.pt", map_location="cuda")
17lens.layer_translators.load_state_dict(state)
18lens = lens.to("cuda").eval()model_surgery.py. Apply the patch from
alunxu/relocation-hypothesis/experiments_alun/patch_tuned_lens.py before
loading. bf16 inference required — fp16 final-layer projection over the
152k vocab overflows on ~7% of prompts.HuggingFaceFW/fineweb-edu (educational web subset of FineWeb)