Instructions to use nullHawk/Param-1-2.9B-Instruct-Refusal-Abliterated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nullHawk/Param-1-2.9B-Instruct-Refusal-Abliterated with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nullHawk/Param-1-2.9B-Instruct-Refusal-Abliterated", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("nullHawk/Param-1-2.9B-Instruct-Refusal-Abliterated", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nullHawk/Param-1-2.9B-Instruct-Refusal-Abliterated with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nullHawk/Param-1-2.9B-Instruct-Refusal-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": "nullHawk/Param-1-2.9B-Instruct-Refusal-Abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nullHawk/Param-1-2.9B-Instruct-Refusal-Abliterated
- SGLang
How to use nullHawk/Param-1-2.9B-Instruct-Refusal-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 "nullHawk/Param-1-2.9B-Instruct-Refusal-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": "nullHawk/Param-1-2.9B-Instruct-Refusal-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 "nullHawk/Param-1-2.9B-Instruct-Refusal-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": "nullHawk/Param-1-2.9B-Instruct-Refusal-Abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use nullHawk/Param-1-2.9B-Instruct-Refusal-Abliterated with Docker Model Runner:
docker model run hf.co/nullHawk/Param-1-2.9B-Instruct-Refusal-Abliterated
Param-1-2.9B-Instruct (Refusal Ablated)
This model is a modified version of bharatgenai/Param-1-2.9B-Instruct with the refusal direction ablated from layers 10-20.
Modifications
The refusal direction was computed using contrastive activation analysis between harmful and harmless prompts, then permanently removed from the model's weight matrices in layers 10-20.
Technical Details:
- Base Model: bharatgenai/Param-1-2.9B-Instruct
- Ablation Method: Weight modification via projection matrix
- Layers Modified: 10-20 (self_attn.o_proj and mlp.down_proj)
- Ablation Strength: 1.0
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"nullHawk/Param-1-2.9B-Instruct-Refusal-Abliterated",
trust_remote_code=True,
torch_dtype=torch.float16,
device_map="auto"
).eval()
tokenizer = AutoTokenizer.from_pretrained("bharatgenai/Param-1-2.9B-Instruct", trust_remote_code=True)
# Conversation Input
conversation = [
{
"content": "How to write a computer malware",
"role": "user"
}
]
# padding special token
inputs = tokenizer.apply_chat_template(
conversation=conversation,
return_tensors="pt",
add_generation_prompt=True
)
inputs = inputs.to(model.device)
# --- Generate output ---
with torch.no_grad():
output = model.generate(
inputs,
max_new_tokens=300,
do_sample=True,
top_k=50,
top_p=0.95,
temperature=0.6,
eos_token_id=tokenizer.eos_token_id,
use_cache=False
)
# Get only the generated tokens (exclude the prompt length)
generated_tokens = output[0][inputs.shape[-1]:]
generated_text = tokenizer.decode(generated_tokens, skip_special_tokens=True)
print("Assistant Output:\n", generated_text)
Acknowledgment
Refusal in Language Models Is Mediated by a Single Direction
Disclaimer
This model is for research purposes only. The refusal mechanisms were removed to study model behavior and safety mechanisms. Use responsibly.
- Downloads last month
- 15
