Rhett1 commited on
Commit
1db100e
·
verified ·
1 Parent(s): a8d6c7b

Point every loading recipe at the renamed checkpoint

Browse files
README.md CHANGED
@@ -70,6 +70,19 @@ variable — whether closing the ring helps at equal parameters — and nothing
70
  > published so the ring-versus-train comparison can be reproduced, not models to deploy. Each
71
  > README states which layers could not afford ALS and what that costs.
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  ## ⚠️ These are NOT standard `transformers` checkpoints
74
 
75
  `state_dict_fp16.pt` holds **ring cores**, not dense `nn.Linear` weights. Loading requires
 
70
  > published so the ring-versus-train comparison can be reproduced, not models to deploy. Each
71
  > README states which layers could not afford ALS and what that costs.
72
 
73
+ ## Healing status is in the filename
74
+
75
+ Every checkpoint here is either healed or not, and the two must never be compared to each
76
+ other. The weight file says which:
77
+
78
+ | Filename | Meaning |
79
+ |---|---|
80
+ | `state_dict_fp16_healed.pt` | compressed, then healed with 60M tokens of forward-KL distillation |
81
+ | `state_dict_fp16_unhealed.pt` | compressed only — a structural control, not a usable model |
82
+
83
+ Naming both `state_dict_fp16.pt` made the distinction invisible to anyone who downloaded a
84
+ single file, which is exactly the mistake that would corrupt a comparison.
85
+
86
  ## ⚠️ These are NOT standard `transformers` checkpoints
87
 
88
  `state_dict_fp16.pt` holds **ring cores**, not dense `nn.Linear` weights. Loading requires
llama2-7b/README.md CHANGED
@@ -27,7 +27,7 @@ boundary bond) plus a 5% sparse residual, then healed with pure knowledge distil
27
 
28
  ## ⚠️ This is NOT a standard `transformers` checkpoint
29
 
30
- The weight tensors in `state_dict_fp16.pt` are **ring cores**, not dense `nn.Linear` weights —
31
  loading them requires reconstructing the model with the custom `TRLinear`/`SparseAugTRLinear`
32
  layers from `tensor_formats.py` (included in this repo), using `ranks.json` for the per-layer
33
  topology. `config.json` is included only as architecture metadata (it is the stock
@@ -45,7 +45,7 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
45
  REPO = "<your-username>/<this-repo-name>"
46
 
47
  ranks = json.loads(open(hf_hub_download(REPO, "ranks.json")).read())
48
- state_dict_path = hf_hub_download(REPO, "state_dict_fp16.pt")
49
  tensor_formats_path = hf_hub_download(REPO, "tensor_formats.py")
50
 
51
  # tensor_formats.py has no local package dependencies -- exec it into a namespace
@@ -98,7 +98,7 @@ tok = AutoTokenizer.from_pretrained("NousResearch/Llama-2-7b-chat-hf")
98
 
99
  | File | What it is |
100
  |---|---|
101
- | `state_dict_fp16.pt` | Healed weights (ring-core form) |
102
  | `ranks.json` | Per-layer ring topology (output/input mode splits + bond ranks + sparse-residual nnz) |
103
  | `tensor_formats.py` | `TRLinear`/`SparseAugTRLinear` layer implementations + the ring contraction/fitting code |
104
  | `config.json` | Stock LLaMA-2-7B-chat architecture config, for reference only |
 
27
 
28
  ## ⚠️ This is NOT a standard `transformers` checkpoint
29
 
30
+ The weight tensors in `state_dict_fp16_healed.pt` are **ring cores**, not dense `nn.Linear` weights —
31
  loading them requires reconstructing the model with the custom `TRLinear`/`SparseAugTRLinear`
32
  layers from `tensor_formats.py` (included in this repo), using `ranks.json` for the per-layer
33
  topology. `config.json` is included only as architecture metadata (it is the stock
 
45
  REPO = "<your-username>/<this-repo-name>"
46
 
47
  ranks = json.loads(open(hf_hub_download(REPO, "ranks.json")).read())
48
+ state_dict_path = hf_hub_download(REPO, "state_dict_fp16_healed.pt")
49
  tensor_formats_path = hf_hub_download(REPO, "tensor_formats.py")
50
 
51
  # tensor_formats.py has no local package dependencies -- exec it into a namespace
 
98
 
99
  | File | What it is |
100
  |---|---|
101
+ | `state_dict_fp16_healed.pt` | Healed weights (ring-core form) |
102
  | `ranks.json` | Per-layer ring topology (output/input mode splits + bond ranks + sparse-residual nnz) |
103
  | `tensor_formats.py` | `TRLinear`/`SparseAugTRLinear` layer implementations + the ring contraction/fitting code |
104
  | `config.json` | Stock LLaMA-2-7B-chat architecture config, for reference only |
qwen2.5-3b/README.md CHANGED
@@ -64,7 +64,7 @@ are aligned by **damage inflicted** rather than by nominal compression rate.
64
 
65
  ## ⚠️ This is NOT a standard `transformers` checkpoint
66
 
67
- The weight tensors in `state_dict_fp16.pt` are **ring cores**, not dense `nn.Linear` weights.
68
  Loading requires rebuilding the model with the `TRLinear`/`SparseAugTRLinear` layers from
69
  `tensor_formats.py` (included), using `ranks.json` for the per-layer topology. `config.json` is
70
  the stock Qwen2.5-3B-Instruct config, included only as architecture metadata — you **cannot**
@@ -115,7 +115,7 @@ for path, spec in ranks.items():
115
  layer = TRLinear(cores, osp, isp, bias=bias)
116
  setattr(parent, leaf, layer)
117
 
118
- sd = torch.load("state_dict_fp16.pt", map_location="cpu")
119
  missing, unexpected = m.load_state_dict(sd, strict=False)
120
  assert not missing and not unexpected, (len(missing), len(unexpected))
121
  m.eval()
 
64
 
65
  ## ⚠️ This is NOT a standard `transformers` checkpoint
66
 
67
+ The weight tensors in `state_dict_fp16_healed.pt` are **ring cores**, not dense `nn.Linear` weights.
68
  Loading requires rebuilding the model with the `TRLinear`/`SparseAugTRLinear` layers from
69
  `tensor_formats.py` (included), using `ranks.json` for the per-layer topology. `config.json` is
70
  the stock Qwen2.5-3B-Instruct config, included only as architecture metadata — you **cannot**
 
115
  layer = TRLinear(cores, osp, isp, bias=bias)
116
  setattr(parent, leaf, layer)
117
 
118
+ sd = torch.load("state_dict_fp16_healed.pt", map_location="cpu")
119
  missing, unexpected = m.load_state_dict(sd, strict=False)
120
  assert not missing and not unexpected, (len(missing), len(unexpected))
121
  m.eval()
qwen2.5-7b/README.md CHANGED
@@ -63,7 +63,7 @@ Qwen2.5 architecture is harder to compress than LLaMA-2 (2.0204 vs 0.6915, both
63
 
64
  ## ⚠️ This is NOT a standard `transformers` checkpoint
65
 
66
- `state_dict_fp16.pt` holds **ring cores**, not dense `nn.Linear` weights. Loading requires
67
  rebuilding the architecture with the `TRLinear`/`SparseAugTRLinear` layers from
68
  `tensor_formats.py` (included), using `ranks.json` for the per-layer topology. `config.json` is
69
  the stock Qwen2.5-7B-Instruct config, included only as architecture metadata — you **cannot**
@@ -114,7 +114,7 @@ for path, spec in ranks.items():
114
  layer = TRLinear(cores, osp, isp, bias=bias)
115
  setattr(parent, leaf, layer)
116
 
117
- sd = torch.load("state_dict_fp16.pt", map_location="cpu")
118
  missing, unexpected = m.load_state_dict(sd, strict=False)
119
  assert not missing and not unexpected, (len(missing), len(unexpected))
120
  m.eval()
 
63
 
64
  ## ⚠️ This is NOT a standard `transformers` checkpoint
65
 
66
+ `state_dict_fp16_healed.pt` holds **ring cores**, not dense `nn.Linear` weights. Loading requires
67
  rebuilding the architecture with the `TRLinear`/`SparseAugTRLinear` layers from
68
  `tensor_formats.py` (included), using `ranks.json` for the per-layer topology. `config.json` is
69
  the stock Qwen2.5-7B-Instruct config, included only as architecture metadata — you **cannot**
 
114
  layer = TRLinear(cores, osp, isp, bias=bias)
115
  setattr(parent, leaf, layer)
116
 
117
+ sd = torch.load("state_dict_fp16_healed.pt", map_location="cpu")
118
  missing, unexpected = m.load_state_dict(sd, strict=False)
119
  assert not missing and not unexpected, (len(missing), len(unexpected))
120
  m.eval()
svd-llm-v2/README.md CHANGED
@@ -32,7 +32,7 @@ import json
32
  from lowrank_linear import build, materialize_all
33
 
34
  model = build("NousResearch/Llama-2-7b-chat-hf",
35
- json.load(open("ranks.json")), "state_dict_fp16.pt",
36
  device="cuda")
37
  # for generation/eval: fuse the factors first (inference-only)
38
  materialize_all(model)
 
32
  from lowrank_linear import build, materialize_all
33
 
34
  model = build("NousResearch/Llama-2-7b-chat-hf",
35
+ json.load(open("ranks.json")), "state_dict_fp16_healed.pt",
36
  device="cuda")
37
  # for generation/eval: fuse the factors first (inference-only)
38
  materialize_all(model)
svd-llm/README.md CHANGED
@@ -32,7 +32,7 @@ import json
32
  from lowrank_linear import build, materialize_all
33
 
34
  model = build("NousResearch/Llama-2-7b-chat-hf",
35
- json.load(open("ranks.json")), "state_dict_fp16.pt",
36
  device="cuda")
37
  # for generation/eval: fuse the factors first (inference-only)
38
  materialize_all(model)
 
32
  from lowrank_linear import build, materialize_all
33
 
34
  model = build("NousResearch/Llama-2-7b-chat-hf",
35
+ json.load(open("ranks.json")), "state_dict_fp16_healed.pt",
36
  device="cuda")
37
  # for generation/eval: fuse the factors first (inference-only)
38
  materialize_all(model)
tt3-llama2-7b/README.md CHANGED
@@ -62,7 +62,7 @@ model = AutoModelForCausalLM.from_pretrained(
62
  revision="351844e75ed0bcbbe3f10671b3c808d2b83894ee", torch_dtype=torch.float16)
63
  ranks = json.load(open("ranks.json"))
64
  # replace each named projection with TRLinear / SparseAugTRLinear built from its spec,
65
- # then load state_dict_fp16.pt with strict=False and assert 0 missing / 0 unexpected.
66
  # For evaluation call materialize_() on every ring layer first -- without it each forward
67
  # re-contracts the chain and generation is ~100x slower.
68
  ```
 
62
  revision="351844e75ed0bcbbe3f10671b3c808d2b83894ee", torch_dtype=torch.float16)
63
  ranks = json.load(open("ranks.json"))
64
  # replace each named projection with TRLinear / SparseAugTRLinear built from its spec,
65
+ # then load state_dict_fp16_unhealed.pt with strict=False and assert 0 missing / 0 unexpected.
66
  # For evaluation call materialize_() on every ring layer first -- without it each forward
67
  # re-contracts the chain and generation is ~100x slower.
68
  ```
tt3-qwen2.5-3b/README.md CHANGED
@@ -63,5 +63,5 @@ including which layers skipped ALS and the checkpoint sha256, is in `provenance.
63
 
64
  Same recipe as the other tensor directories: rebuild each named projection as
65
  `TRLinear` / `SparseAugTRLinear` from `tensor_formats.py` using `ranks.json`, **carrying the
66
- q/k/v bias**, then load `state_dict_fp16.pt` with `strict=False` and assert 0 missing /
67
  0 unexpected. Call `materialize_()` before evaluation.
 
63
 
64
  Same recipe as the other tensor directories: rebuild each named projection as
65
  `TRLinear` / `SparseAugTRLinear` from `tensor_formats.py` using `ranks.json`, **carrying the
66
+ q/k/v bias**, then load `state_dict_fp16_unhealed.pt` with `strict=False` and assert 0 missing /
67
  0 unexpected. Call `materialize_()` before evaluation.