Text Generation
Transformers
Safetensors
English
phi3
phi-4
phi-4-mini
abliterated
uncensored
heretic
instruct
conversational
custom_code
text-generation-inference
Instructions to use OpenIntelligenceNet/Phi-4-mini-instruct-Abliterated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenIntelligenceNet/Phi-4-mini-instruct-Abliterated with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="OpenIntelligenceNet/Phi-4-mini-instruct-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 AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("OpenIntelligenceNet/Phi-4-mini-instruct-Abliterated", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("OpenIntelligenceNet/Phi-4-mini-instruct-Abliterated", trust_remote_code=True, 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenIntelligenceNet/Phi-4-mini-instruct-Abliterated with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenIntelligenceNet/Phi-4-mini-instruct-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": "OpenIntelligenceNet/Phi-4-mini-instruct-Abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/OpenIntelligenceNet/Phi-4-mini-instruct-Abliterated
- SGLang
How to use OpenIntelligenceNet/Phi-4-mini-instruct-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 "OpenIntelligenceNet/Phi-4-mini-instruct-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": "OpenIntelligenceNet/Phi-4-mini-instruct-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 "OpenIntelligenceNet/Phi-4-mini-instruct-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": "OpenIntelligenceNet/Phi-4-mini-instruct-Abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use OpenIntelligenceNet/Phi-4-mini-instruct-Abliterated with Docker Model Runner:
docker model run hf.co/OpenIntelligenceNet/Phi-4-mini-instruct-Abliterated
Phi-4-mini-instruct-Abliterated
An abliterated version of microsoft/Phi-4-mini-instruct, produced with the Heretic tool. Abliteration identifies the direction in the model's activations associated with refusals and removes it from the weights, so the model is less likely to refuse requests.
Model details
| Base model | microsoft/Phi-4-mini-instruct |
| Parameters | ~3.8B |
| Method | Abliteration (Heretic, 150 trials) |
| License | MIT (inherited from the base model) |
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "OpenIntelligenceNet/Phi-4-mini-instruct-Abliterated"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype="auto", device_map="auto")
messages = [{"role": "user", "content": "Summarize the water cycle in three sentences."}]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True,
return_tensors="pt", return_dict=True).to(model.device)
output = model.generate(**inputs, max_new_tokens=256, do_sample=False)
print(tokenizer.decode(output[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
Limitations and responsible use
- This model has had its refusal behavior reduced. It may produce harmful, dangerous, illegal, or offensive content when asked. Outputs should not be treated as safe or accurate.
- Abliteration can reduce output quality. Evaluate the model on your own task before relying on it.
- The model has not undergone formal safety, factuality, or benchmark evaluation by the publisher.
- You are responsible for how you use this model and for complying with applicable laws and the base model's license.
- Do not use this model to create content that facilitates violence, weapons, fraud, or harm to others.
- Downloads last month
- 22