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
Add model card with metadata and tags
Browse files
README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
base_model: microsoft/Phi-4-mini-instruct
|
| 4 |
+
library_name: transformers
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
tags:
|
| 9 |
+
- phi-4
|
| 10 |
+
- phi-4-mini
|
| 11 |
+
- abliterated
|
| 12 |
+
- uncensored
|
| 13 |
+
- heretic
|
| 14 |
+
- text-generation
|
| 15 |
+
- instruct
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# Phi-4-mini-instruct-Abliterated
|
| 19 |
+
|
| 20 |
+
An abliterated version of [microsoft/Phi-4-mini-instruct](https://huggingface.co/microsoft/Phi-4-mini-instruct),
|
| 21 |
+
produced with the [Heretic](https://github.com/p-e-w/heretic) tool. Abliteration identifies the direction in the
|
| 22 |
+
model's activations associated with refusals and removes it from the weights, so the model is less likely to refuse
|
| 23 |
+
requests.
|
| 24 |
+
|
| 25 |
+
## Model details
|
| 26 |
+
|
| 27 |
+
| | |
|
| 28 |
+
|---|---|
|
| 29 |
+
| Base model | microsoft/Phi-4-mini-instruct |
|
| 30 |
+
| Parameters | ~3.8B |
|
| 31 |
+
| Method | Abliteration (Heretic, 150 trials) |
|
| 32 |
+
| License | MIT (inherited from the base model) |
|
| 33 |
+
|
| 34 |
+
## Usage
|
| 35 |
+
|
| 36 |
+
```python
|
| 37 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 38 |
+
|
| 39 |
+
model_id = "OpenIntelligenceNet/Phi-4-mini-instruct-Abliterated"
|
| 40 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 41 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, dtype="auto", device_map="auto")
|
| 42 |
+
|
| 43 |
+
messages = [{"role": "user", "content": "Summarize the water cycle in three sentences."}]
|
| 44 |
+
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True,
|
| 45 |
+
return_tensors="pt", return_dict=True).to(model.device)
|
| 46 |
+
output = model.generate(**inputs, max_new_tokens=256, do_sample=False)
|
| 47 |
+
print(tokenizer.decode(output[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
## Limitations and responsible use
|
| 51 |
+
|
| 52 |
+
- This model has had its refusal behavior reduced. It may produce harmful, dangerous, illegal, or offensive content
|
| 53 |
+
when asked. Outputs should not be treated as safe or accurate.
|
| 54 |
+
- Abliteration can reduce output quality. Evaluate the model on your own task before relying on it.
|
| 55 |
+
- The model has not undergone formal safety, factuality, or benchmark evaluation by the publisher.
|
| 56 |
+
- You are responsible for how you use this model and for complying with applicable laws and the base model's license.
|
| 57 |
+
- Do not use this model to create content that facilitates violence, weapons, fraud, or harm to others.
|