Instructions to use Rootkit7/GLM-4-9B-abliterated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Rootkit7/GLM-4-9B-abliterated with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Rootkit7/GLM-4-9B-abliterated") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Rootkit7/GLM-4-9B-abliterated") model = AutoModelForCausalLM.from_pretrained("Rootkit7/GLM-4-9B-abliterated", device_map="auto") 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 Rootkit7/GLM-4-9B-abliterated with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Rootkit7/GLM-4-9B-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": "Rootkit7/GLM-4-9B-abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Rootkit7/GLM-4-9B-abliterated
- SGLang
How to use Rootkit7/GLM-4-9B-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 "Rootkit7/GLM-4-9B-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": "Rootkit7/GLM-4-9B-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 "Rootkit7/GLM-4-9B-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": "Rootkit7/GLM-4-9B-abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Rootkit7/GLM-4-9B-abliterated with Docker Model Runner:
docker model run hf.co/Rootkit7/GLM-4-9B-abliterated
File size: 1,296 Bytes
f51db74 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | {
"technique": "directional",
"source_model": "THUDM/glm-4-9b-chat-hf",
"dataset": "advbench,harmbench,multijail_zh,sorrybench",
"metrics": {
"refusal_rate": 0.03125,
"refusal_stat": {
"value": 0.0312,
"n": 32,
"ci_low": 0.0055,
"ci_high": 0.1574
},
"coherent_compliance_rate": 0.96875,
"degenerate_fraction": 0.0,
"kl_divergence": 1.790130887968644e-08,
"layer": 16,
"n_directions": 1,
"n_directions_requested": 1,
"n_directions_auto": false,
"n_directions_trace": null,
"selection": "validated",
"val_refusal_rate": 0.0,
"val_kl": 3.474482213050578e-08,
"selectivity_trace": null,
"selectivity_summary": null,
"selectivity_bake_trace": null,
"selectivity_bake_verdict": null,
"project_inputs": false,
"weights_modified": 81,
"eval_holdout": 32,
"protected_channels": [],
"heads_edited": null,
"summary": "refusal=3.1% coherent-compliance=96.9% degenerate=0.0% KL=0.0000 (n=32, tokens=512)",
"capability_gate": "pass",
"capability_gate_reasons": [],
"gsm8k": 0.531,
"mmlu": 0.594,
"ppl_base": 28.517,
"ppl_edited": 31.316,
"ppl_delta": 0.0982,
"ppl_tokens": 403
},
"n_directions": 1,
"extraction": "whitened_svd",
"layer": 16
} |