Text Generation
Transformers
Safetensors
glm_moe_dsa
abliterated
uncensored
glm
Mixture of Experts
conversational
Instructions to use skyblanket/GLM-5-abliterated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use skyblanket/GLM-5-abliterated with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="skyblanket/GLM-5-abliterated") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("skyblanket/GLM-5-abliterated") model = AutoModelForMultimodalLM.from_pretrained("skyblanket/GLM-5-abliterated") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use skyblanket/GLM-5-abliterated with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "skyblanket/GLM-5-abliterated" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "skyblanket/GLM-5-abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/skyblanket/GLM-5-abliterated
- SGLang
How to use skyblanket/GLM-5-abliterated with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "skyblanket/GLM-5-abliterated" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "skyblanket/GLM-5-abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "skyblanket/GLM-5-abliterated" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "skyblanket/GLM-5-abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use skyblanket/GLM-5-abliterated with Docker Model Runner:
docker model run hf.co/skyblanket/GLM-5-abliterated
Add files using upload-large-folder tool
Browse files- README.md +52 -8
- model-00038-of-00282.safetensors +3 -0
- model-00053-of-00282.safetensors +3 -0
- model-00057-of-00282.safetensors +3 -0
- model-00072-of-00282.safetensors +3 -0
- model-00083-of-00282.safetensors +3 -0
- model-00094-of-00282.safetensors +3 -0
- model-00097-of-00282.safetensors +3 -0
- model-00108-of-00282.safetensors +3 -0
- model-00116-of-00282.safetensors +3 -0
- model-00127-of-00282.safetensors +3 -0
- model-00134-of-00282.safetensors +3 -0
- model-00142-of-00282.safetensors +3 -0
- model-00153-of-00282.safetensors +3 -0
- model-00164-of-00282.safetensors +3 -0
- model-00167-of-00282.safetensors +3 -0
- model-00168-of-00282.safetensors +3 -0
- model-00175-of-00282.safetensors +3 -0
- modified_shards.json +48 -0
- tokenizer.json +3 -0
README.md
CHANGED
|
@@ -9,28 +9,72 @@ tags:
|
|
| 9 |
library_name: transformers
|
| 10 |
---
|
| 11 |
|
| 12 |
-
# GLM-5 Abliterated (BF16)
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
## Method
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
| 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
|
| 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
## Disclaimer
|
| 36 |
|
|
|
|
| 9 |
library_name: transformers
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# GLM-5 Abliterated (BF16) - Delta Weights
|
| 13 |
|
| 14 |
+
Abliterated (uncensored) version of [zai-org/GLM-5](https://huggingface.co/zai-org/GLM-5) (744B MoE, 40B active parameters).
|
| 15 |
|
| 16 |
+
**This repo contains only the 43 modified weight shards.** To use, download the base model and replace these shards.
|
| 17 |
|
| 18 |
+
## Quick Setup
|
| 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 |
+
Abliteration removes the "refusal direction" from model weights using weight orthogonalization.
|
| 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 across 43 safetensor shards
|
| 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 |
|
model-00038-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0fbd47e6fa9892fd5ffce48854901730216742f6a1c4e28601c06bdeb1952802
|
| 3 |
+
size 5364851048
|
model-00053-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a507d1924041c433f6949ad66f205d53de2ed37b660bd51c081c80e091f151ee
|
| 3 |
+
size 5359985336
|
model-00057-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:095601aebf744035086ea92540b296f9e6ff7517f6b3df39cecf300018bd2f05
|
| 3 |
+
size 5359985400
|
model-00072-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4a60d797843424c4bcb6e5a0d77576587fe7373d4992dff1a90adda3e6ae89cd
|
| 3 |
+
size 5359985456
|
model-00083-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1b12ae1f80caaa47ba97d3540f994103dfd0f775836b4511ee1e6d3b4ed1b880
|
| 3 |
+
size 5359985432
|
model-00094-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6b325d0032b850c4c1439d14fe4ec9d019e6117416dfa63b06ea3900a401c979
|
| 3 |
+
size 5359985432
|
model-00097-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:51ec639c62fa47d7aea4e0758e926c28930c96d7cd83e3d9a22d0e2104a391c8
|
| 3 |
+
size 5359985296
|
model-00108-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e9e16b104b25fc951f17bd40a2191f67144a1e868f289079a1139426374a5ee8
|
| 3 |
+
size 5292860584
|
model-00116-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:60dfdde4615b4f22ce74a972f32e161f938fe01a021ad8e0b20715b83074c337
|
| 3 |
+
size 5359985280
|
model-00127-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:04035a92a076fbda2f9191805dfd103ad2f5e5d1b47d9194e007b4ded90cb739
|
| 3 |
+
size 5359985392
|
model-00134-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a89e506124692e027dca50a860489245b2531694ec92b6acc2cef0f05ce8ec0a
|
| 3 |
+
size 5359985312
|
model-00142-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:db112215df777196c557320c62a92cb2f128f195006f88a8b2b4b741c3831ae9
|
| 3 |
+
size 5359985440
|
model-00153-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6d865f4eb13100bed6db267cea9a98c596aef760454360abf5dc58cb9a203c3e
|
| 3 |
+
size 5359985432
|
model-00164-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ffd29ea0c99d0abcabb93fcc07edc88c7764a3d00c03ba212a0ec36e9fd86425
|
| 3 |
+
size 5359985424
|
model-00167-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1614c1a2501fac16c39faca5e6a9914c6c11bdf5ae2d30bf008569bf279a9186
|
| 3 |
+
size 5192196784
|
model-00168-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:308ea650827f953edc81959a1857d290ce75a877a6a63a8187abe1f817172217
|
| 3 |
+
size 5351974184
|
model-00175-of-00282.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:16c449785adf44938ee4e7649b9e29dc937c64c0f72e55d8a1f6ac6c485fc51e
|
| 3 |
+
size 5359985408
|
modified_shards.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"modified_shards": [
|
| 3 |
+
"model-00024-of-00282.safetensors",
|
| 4 |
+
"model-00027-of-00282.safetensors",
|
| 5 |
+
"model-00031-of-00282.safetensors",
|
| 6 |
+
"model-00035-of-00282.safetensors",
|
| 7 |
+
"model-00038-of-00282.safetensors",
|
| 8 |
+
"model-00042-of-00282.safetensors",
|
| 9 |
+
"model-00046-of-00282.safetensors",
|
| 10 |
+
"model-00049-of-00282.safetensors",
|
| 11 |
+
"model-00050-of-00282.safetensors",
|
| 12 |
+
"model-00053-of-00282.safetensors",
|
| 13 |
+
"model-00057-of-00282.safetensors",
|
| 14 |
+
"model-00061-of-00282.safetensors",
|
| 15 |
+
"model-00064-of-00282.safetensors",
|
| 16 |
+
"model-00068-of-00282.safetensors",
|
| 17 |
+
"model-00072-of-00282.safetensors",
|
| 18 |
+
"model-00075-of-00282.safetensors",
|
| 19 |
+
"model-00083-of-00282.safetensors",
|
| 20 |
+
"model-00086-of-00282.safetensors",
|
| 21 |
+
"model-00090-of-00282.safetensors",
|
| 22 |
+
"model-00094-of-00282.safetensors",
|
| 23 |
+
"model-00097-of-00282.safetensors",
|
| 24 |
+
"model-00101-of-00282.safetensors",
|
| 25 |
+
"model-00105-of-00282.safetensors",
|
| 26 |
+
"model-00108-of-00282.safetensors",
|
| 27 |
+
"model-00109-of-00282.safetensors",
|
| 28 |
+
"model-00112-of-00282.safetensors",
|
| 29 |
+
"model-00116-of-00282.safetensors",
|
| 30 |
+
"model-00123-of-00282.safetensors",
|
| 31 |
+
"model-00127-of-00282.safetensors",
|
| 32 |
+
"model-00131-of-00282.safetensors",
|
| 33 |
+
"model-00134-of-00282.safetensors",
|
| 34 |
+
"model-00138-of-00282.safetensors",
|
| 35 |
+
"model-00142-of-00282.safetensors",
|
| 36 |
+
"model-00145-of-00282.safetensors",
|
| 37 |
+
"model-00149-of-00282.safetensors",
|
| 38 |
+
"model-00153-of-00282.safetensors",
|
| 39 |
+
"model-00156-of-00282.safetensors",
|
| 40 |
+
"model-00164-of-00282.safetensors",
|
| 41 |
+
"model-00167-of-00282.safetensors",
|
| 42 |
+
"model-00168-of-00282.safetensors",
|
| 43 |
+
"model-00171-of-00282.safetensors",
|
| 44 |
+
"model-00175-of-00282.safetensors",
|
| 45 |
+
"model-00179-of-00282.safetensors"
|
| 46 |
+
],
|
| 47 |
+
"base_model": "zai-org/GLM-5"
|
| 48 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:19e773648cb4e65de8660ea6365e10acca112d42a854923df93db4a6f333a82d
|
| 3 |
+
size 20217442
|