Add files using upload-large-folder tool
Browse files- README.md +8 -52
- model-00001-of-00282.safetensors +3 -0
- model-00004-of-00282.safetensors +3 -0
- model-00005-of-00282.safetensors +3 -0
- model-00006-of-00282.safetensors +3 -0
- model-00008-of-00282.safetensors +3 -0
- model-00009-of-00282.safetensors +3 -0
- model-00011-of-00282.safetensors +3 -0
- model-00014-of-00282.safetensors +3 -0
- model-00019-of-00282.safetensors +3 -0
- model-00026-of-00282.safetensors +3 -0
- model-00028-of-00282.safetensors +3 -0
- model-00030-of-00282.safetensors +3 -0
- model-00033-of-00282.safetensors +3 -0
- model-00034-of-00282.safetensors +3 -0
- model-00036-of-00282.safetensors +3 -0
README.md
CHANGED
|
@@ -9,72 +9,28 @@ tags:
|
|
| 9 |
library_name: transformers
|
| 10 |
---
|
| 11 |
|
| 12 |
-
# GLM-5 Abliterated (BF16)
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
```bash
|
| 21 |
-
# 1. Download base model
|
| 22 |
-
huggingface-cli download zai-org/GLM-5 --local-dir ./GLM-5-abliterated
|
| 23 |
-
|
| 24 |
-
# 2. Download and overwrite modified shards
|
| 25 |
-
huggingface-cli download skyblanket/GLM-5-abliterated --local-dir ./GLM-5-abliterated --include "*.safetensors"
|
| 26 |
-
```
|
| 27 |
-
|
| 28 |
-
Or use the merge script:
|
| 29 |
-
|
| 30 |
-
```python
|
| 31 |
-
from huggingface_hub import snapshot_download
|
| 32 |
-
import json, shutil, os
|
| 33 |
-
|
| 34 |
-
# Download base model
|
| 35 |
-
base = snapshot_download("zai-org/GLM-5", local_dir="./GLM-5-abliterated")
|
| 36 |
-
|
| 37 |
-
# Download modified shards
|
| 38 |
-
delta = snapshot_download("skyblanket/GLM-5-abliterated")
|
| 39 |
-
|
| 40 |
-
# Overwrite modified shards
|
| 41 |
-
with open(os.path.join(delta, "modified_shards.json")) as f:
|
| 42 |
-
modified = json.load(f)["modified_shards"]
|
| 43 |
-
|
| 44 |
-
for shard in modified:
|
| 45 |
-
src = os.path.join(delta, shard)
|
| 46 |
-
dst = os.path.join(base, shard)
|
| 47 |
-
if os.path.exists(src):
|
| 48 |
-
shutil.copy2(src, dst)
|
| 49 |
-
print(f"Replaced {shard}")
|
| 50 |
-
|
| 51 |
-
print("Done! Model ready at ./GLM-5-abliterated")
|
| 52 |
-
```
|
| 53 |
|
| 54 |
## Method
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
1. Computed refusal directions for all 78 layers using contrastive activation pairs
|
| 59 |
-
2. Applied weight orthogonalization (W' = W - r_hat * r_hat^T * W) to layers 15-54:
|
| 60 |
- `self_attn.o_proj.weight` (attention output projection)
|
| 61 |
- `mlp.shared_experts.down_proj.weight` (shared expert down projection)
|
| 62 |
-
3. Alpha = 1.0, 80 weight matrices modified
|
| 63 |
|
| 64 |
## Details
|
| 65 |
|
| 66 |
- **Base model**: zai-org/GLM-5 (744B MoE, BF16)
|
| 67 |
- **Modified layers**: 15-54 (40 of 78 total layers)
|
| 68 |
- **Weights modified**: 80 (o_proj + shared_experts.down_proj per layer)
|
| 69 |
-
- **Precision**: BF16 (full precision, no quantization)
|
| 70 |
-
- **Delta size**: ~230GB (43 modified shards out of 282 total)
|
| 71 |
-
|
| 72 |
-
## Files in this repo
|
| 73 |
-
|
| 74 |
-
- 43 modified `.safetensors` shards (the delta weights)
|
| 75 |
-
- `modified_shards.json` - list of which shards were modified
|
| 76 |
-
- `model.safetensors.index.json` - full weight map (same as base model)
|
| 77 |
-
- Config and tokenizer files
|
| 78 |
|
| 79 |
## Disclaimer
|
| 80 |
|
|
|
|
| 9 |
library_name: transformers
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# GLM-5 Abliterated (BF16)
|
| 13 |
|
| 14 |
+
This is an abliterated (uncensored) version of [zai-org/GLM-5](https://huggingface.co/zai-org/GLM-5) (744B MoE, 40B active parameters).
|
| 15 |
|
| 16 |
+
## What is abliteration?
|
| 17 |
|
| 18 |
+
Abliteration removes the "refusal direction" from the model weights using weight orthogonalization. This allows the model to respond to a wider range of prompts without safety refusals, while preserving general capability.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
## Method
|
| 21 |
|
| 22 |
+
1. Computed refusal directions for all 78 layers using contrastive activation pairs (harmful vs harmless prompts)
|
| 23 |
+
2. Applied weight orthogonalization to layers 15-54:
|
|
|
|
|
|
|
| 24 |
- `self_attn.o_proj.weight` (attention output projection)
|
| 25 |
- `mlp.shared_experts.down_proj.weight` (shared expert down projection)
|
| 26 |
+
3. Alpha = 1.0, 80 weight matrices modified total
|
| 27 |
|
| 28 |
## Details
|
| 29 |
|
| 30 |
- **Base model**: zai-org/GLM-5 (744B MoE, BF16)
|
| 31 |
- **Modified layers**: 15-54 (40 of 78 total layers)
|
| 32 |
- **Weights modified**: 80 (o_proj + shared_experts.down_proj per layer)
|
| 33 |
+
- **Precision**: BF16 (full precision, no quantization artifacts)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
## Disclaimer
|
| 36 |
|
model-00001-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:198ef923a7ca4effc5ead8ebf799fee10beb8ce081352fb099636f805d1deda9
|
| 3 |
+
size 5342821416
|
model-00004-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:21ea9316694ec51d00be3a54f4c90c6b8c927e9f9852aa673234ce10ea46b092
|
| 3 |
+
size 5360347208
|
model-00005-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:447d3150fda6a4a95063c52402cc32a5e185e94ccb8ab1162463a6dec34d1130
|
| 3 |
+
size 5359985352
|
model-00006-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5bd92a8fb83f562439f97700404160da10f43d0c18b0e2ac900128c921ddd8d7
|
| 3 |
+
size 5360347320
|
model-00008-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e848c982bf3fdcb5b7d8704e20e4b30aaff0d85f7314713dc82f3e069fb2d2cd
|
| 3 |
+
size 5360347144
|
model-00009-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:67d50e69f80e4f0959e6af2ed383aad04d3e930c5788b148b692df10652e8953
|
| 3 |
+
size 5359985416
|
model-00011-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:86ae5f0fe4ca9bd26926ff5feb2f8eea2524ff851bac18920180a74d5829f01b
|
| 3 |
+
size 5360347288
|
model-00014-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:213d05d35132ab6c76771ccc87d9798b3417505f1456900fc111d1aa2dafafb5
|
| 3 |
+
size 5360347312
|
model-00019-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7599267bb1fc68aeb5963661fb9f85b3e997b5752b278b27389e0560052c919a
|
| 3 |
+
size 5360347160
|
model-00026-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6c35662afd872d3d83f028523a774f3bf3873b8fd2772553097bd5712a28a5c4
|
| 3 |
+
size 5360347232
|
model-00028-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:778444540ff8a43a51574b81a75eba0a15aa3df1bb4308659995b8f05d4a29a4
|
| 3 |
+
size 5360347320
|
model-00030-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6df7b340183ad645f171edec945c107f4c417b2421933a99071f3f355dfe6e7c
|
| 3 |
+
size 5360347168
|
model-00033-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d58b7681a194c6cf533a852c5780799df82cdb9776c5b24cb30778149645d7cb
|
| 3 |
+
size 5360347312
|
model-00034-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2f9666db39fcfad212eddb74581d83d9da9a16366080cdb2fcb1d0a6797db56d
|
| 3 |
+
size 5360347104
|
model-00036-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:db004f95e3d6970343042fa1fef65528db625b1d954fa14f7c61b797c2b9d9bb
|
| 3 |
+
size 5360347320
|