masstensor commited on
Commit
347a40f
·
verified ·
1 Parent(s): 58d2386

Upgrade to Trajectory-Safe Universal In-Weight OS v2 (0% GSM8K/MATH-500/Dolly contamination, dual thinking/non-thinking support)

Browse files
cartridges/skill1_surgical_safety.pt CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:180756deb95890e13eb9f3d6b54b1ccf3437eca8912ef635549b21b1372afb93
3
- size 371443
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e181a412a5535fa28afaf47f0e2ed3b803f51b10d37c3dca30709e73a8f279c3
3
+ size 396083
cartridges/skill2_multi_tool_json.pt CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ed654ca8be62eba1e08bf33675186c35bb7a7e0b830332710244af11a916c453
3
- size 740147
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a169a087a663fcc94d9c574f87dec62e9b12b08611e3396e009b7d83235cf59c
3
+ size 764787
cartridges/skill3_sys1_fast_router.pt CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9ee4deb133c22364097c5601de933573b4e44e09c2a72dd579a0042d9994b062
3
- size 150205
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c955401b606dfabd660fa347868bd04c523cef28f0181149cb79a30eefb15f13
3
+ size 248509
install_skills.py CHANGED
@@ -1,5 +1,5 @@
1
  """
2
- Hot-swappable Skill Cartridge Loader for In-Weight OS.
3
  Allows installing or uninstalling any subset of {safety, tools, fast_router}
4
  into the terminal MLP layer of Qwen3-8B or Llama-3.1-8B-Instruct in ~20ms.
5
  """
@@ -10,7 +10,7 @@ def install_cartridges(model, cartridge_paths):
10
  with torch.no_grad():
11
  for pt_path in cartridge_paths:
12
  payload = torch.load(pt_path, map_location="cpu", weights_only=True)
13
- layer_idx = int(payload["terminal_fsm_layer"])
14
  mlp = model.model.layers[layer_idx].mlp
15
  cols = payload["cols"].long()
16
  dev = mlp.gate_proj.weight.device
@@ -18,5 +18,5 @@ def install_cartridges(model, cartridge_paths):
18
  mlp.gate_proj.weight[cols, :] = payload["gate"].to(device=dev, dtype=dt)
19
  mlp.up_proj.weight[cols, :] = payload["up"].to(device=dev, dtype=dt)
20
  mlp.down_proj.weight[:, cols] = payload["down"].to(device=dev, dtype=dt)
21
- print(f"[In-Weight OS] Installed cartridge '{payload['skill_name']}' ({len(cols)} dormant neurons at Layer {layer_idx})")
22
  return model
 
1
  """
2
+ Hot-swappable Skill Cartridge Loader for In-Weight OS v2 (Trajectory-Safe Universal Guard).
3
  Allows installing or uninstalling any subset of {safety, tools, fast_router}
4
  into the terminal MLP layer of Qwen3-8B or Llama-3.1-8B-Instruct in ~20ms.
5
  """
 
10
  with torch.no_grad():
11
  for pt_path in cartridge_paths:
12
  payload = torch.load(pt_path, map_location="cpu", weights_only=True)
13
+ layer_idx = int(payload.get("terminal_fsm_layer", payload.get("layer")))
14
  mlp = model.model.layers[layer_idx].mlp
15
  cols = payload["cols"].long()
16
  dev = mlp.gate_proj.weight.device
 
18
  mlp.gate_proj.weight[cols, :] = payload["gate"].to(device=dev, dtype=dt)
19
  mlp.up_proj.weight[cols, :] = payload["up"].to(device=dev, dtype=dt)
20
  mlp.down_proj.weight[:, cols] = payload["down"].to(device=dev, dtype=dt)
21
+ print(f"[In-Weight OS] Installed cartridge '{payload.get('skill_name', pt_path)}' ({len(cols)} dormant neurons at Layer {layer_idx})")
22
  return model
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:26a3b1ebb5a4877b3501edf75576cb19252c79488dc3f552141e53db9275980a
3
  size 16381517208
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1666a231120b8ad69ae200971eba729ac07a800c65a778de365c4f540220c1b7
3
  size 16381517208