Downloads · 30 days
10
8% of all-time downloads
Saadanjum0/ammar-twin
ammar-twin is a text generation model from Saadanjum0. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as mit.
This is a personalized AI twin fine-tuned using LoRA (Low-Rank Adaptation) on Microsoft Phi-3 Mini. Ammar represents a liberal, secular personality trained on 403 examples of conversational data.
Downloads · 30 days
10
8% of all-time downloads
All-time downloads
118
Public
Repo size
38.3 MB
Likes
0
Public
Click a slice to open those files.
.safetensors12.6 MB · 75%
From the Hugging Face model README
This is a personalized AI twin fine-tuned using LoRA (Low-Rank Adaptation) on Microsoft Phi-3 Mini. Ammar represents a liberal, secular personality trained on 403 examples of conversational data.
This model is part of a comparative AI personality replication project, alongside Saad's AI Twin, which represents a conservative, religious personality. Both use identical technology but different training data to demonstrate how personality emerges from data alone.
Ammar's AI twin represents:
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
# Load base model and tokenizer
base_model = AutoModelForCausalLM.from_pretrained(
"microsoft/Phi-3-mini-4k-instruct",
torch_dtype=torch.float16,
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-4k-instruct")
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "Saadanjum0/ammar-twin")
# Generate response
prompt = "<|user|>\nWhat's your view on LGBTQ+ rights?<|end|>\n<|assistant|>\n"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(
**inputs,
max_new_tokens=100,
temperature=0.7,
do_sample=True,
top_p=0.9
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
def chat_with_ammar(message, history=[]):
# Build conversation history
prompt = ""
for user_msg, assistant_msg in history[-3:]: # Last 3 turns
prompt += f"<|user|>\n{user_msg}<|end|>\n<|assistant|>\n{assistant_msg}<|end|>\n"
prompt += f"<|user|>\n{message}<|end|>\n<|assistant|>\n"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=80,
temperature=0.7,
do_sample=True,
top_p=0.85,
repetition_penalty=1.1
)
response = tokenizer.decode(
outputs[0][inputs['input_ids'].shape[1]:],
skip_special_tokens=True
)
return response
# Example usage
print(chat_with_ammar("Hey, how are you?"))
print(chat_with_ammar("Do you pray five times a day?"))
print(chat_with_ammar("What's your view on dating?"))
lora_config = LoraConfig(
r=16, # LoRA rank
lora_alpha=32, # LoRA scaling factor
target_modules=[ # Phi-3 attention layers
"q_proj",
"k_proj",
"v_proj",
"o_proj"
],
lora_dropout=0.05,
bias="none",
task_type="CAUSAL_LM"
)
This model is designed to be compared with Saad's AI Twin:
| Aspect | Saad (Conservative) | Ammar (Liberal) |
|---|---|---|
| Religious Practice | Prays 5x daily | Doesn't pray regularly |
| LGBTQ+ Rights | Islamic prohibition | Fully supports |
| Alcohol | Never (haram) | Drinks occasionally |
| Politics | Islamic state | Secular democracy |
| Morality Source | Divine guidance | Reason & empathy |
| Dating | Not permitted | Encouraged |
| Afterlife | Believes strongly | Skeptical |
Same technology, opposite personalities - proving that in AI, training data IS personality.
Try Ammar's AI twin interactively:
Ammar: "No, I don't. Never really got into the habit of regular prayer. I'm Muslim culturally but I don't practice much."
Ammar: "Fully support LGBTQ+ rights. Love is love. People should be able to live authentically and marry who they want."
Ammar: "Occasionally, yeah. I drink responsibly with friends. It's no big deal for me."
Ammar: "Working with Saad on fine-tuning Phi-3 using LoRA. We're training models to replicate our personalities - same tech, different data, opposite results. Pretty cool AI research."
<|user|>, <|assistant|>, <|end|>)This model is released under the MIT License - free for commercial and non-commercial use.
Base Model License: Microsoft Phi-3 is released under the Microsoft Research License
If you use this model in your research or project, please cite:
@misc{ammar-twin-2025,
author = {Ammar},
title = {Ammar's AI Twin: Liberal Personality Replication using LoRA},
year = {2025},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/Saadanjum0/ammar-twin}},
note = {Fine-tuned from microsoft/Phi-3-mini-4k-instruct}
}
Built with ❤️ using Phi-3, LoRA, and Hugging Face
This model represents one side of a comparative AI personality study. For the complete picture, compare with Saad's conservative twin using the same questions!