Downloads · 30 days
13
4% of all-time downloads
Saadanjum0/saad-twin
saad-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 on Microsoft Phi-3 Mini (3.8B parameters).
Downloads · 30 days
13
4% of all-time downloads
All-time downloads
311
Public
Repo size
152 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 on Microsoft Phi-3 Mini (3.8B parameters).
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"
)
tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-4k-instruct")
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "SaadAx/saad-twin")
# Generate response
prompt = "<|user|>\nHow do you handle stress?<|end|>\n<|assistant|>\n"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=200, temperature=0.8)
print(tokenizer.decode(outputs[0], skip_special_tokens=False))
import requests
API_URL = "https://api-inference.huggingface.co/models/SaadAx/saad-twin"
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
output = query({
"inputs": "<|user|>\nHello!<|end|>\n<|assistant|>\n",
"parameters": {"max_new_tokens": 200, "temperature": 0.8}
})
print(output)
This model is designed for:
MIT License - Free for commercial and non-commercial use
**Click "Commit changes to main"**
---
### **Step 3: Wait 5-10 Minutes**
After updating the README:
- Hugging Face needs to reprocess your model
- Refresh the page after 10 minutes
- Look for "Hosted inference API" section to appear
---
### **Step 4: Test If It Works**
After 10 minutes, try this in your browser:
Go to: https://huggingface.co/SaadAx/saad-twin
Look for the **inference widget** on the right side. If you see it, type a test message!
---
## **OPTION 2: Use Inference Endpoints (If Free Doesn't Work)**
If free inference doesn't enable, you can deploy a dedicated endpoint.
### **Step 1: Go to Inference Endpoints**
1. Click your profile (top right) → **Settings**
2. In left sidebar: Click **Inference Endpoints** (or go to https://ui.endpoints.huggingface.co/)
### **Step 2: Create New Endpoint**
1. Click **"+ New endpoint"**
2. Fill in:
- **Model Repository:** `SaadAx/saad-twin`
- **Endpoint name:** `saad-twin-api`
- **Cloud Provider:** AWS (or Azure/GCP)
- **Region:** us-east-1 (or closest to you)
- **Instance Type:**
- **CPU:** `cpu.small` (cheapest, slow)
- **GPU:** `gpu.small` (recommended for Phi-3)
### **Pricing (if you go this route):**
CPU (slow): ~$0.03/hour = $20/month GPU (fast): ~$0.60/hour = $400/month