wikimedia/wikipedia
Viewer โข Updated โข 61.6M โข 239k โข 1.38k
How to use mohammed-el-baraka/KhulasaAI with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct")
model = PeftModel.from_pretrained(base_model, "mohammed-el-baraka/KhulasaAI")How to use mohammed-el-baraka/KhulasaAI with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="mohammed-el-baraka/KhulasaAI") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("mohammed-el-baraka/KhulasaAI", device_map="auto")How to use mohammed-el-baraka/KhulasaAI with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "mohammed-el-baraka/KhulasaAI"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "mohammed-el-baraka/KhulasaAI",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/mohammed-el-baraka/KhulasaAI
How to use mohammed-el-baraka/KhulasaAI with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "mohammed-el-baraka/KhulasaAI" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "mohammed-el-baraka/KhulasaAI",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "mohammed-el-baraka/KhulasaAI" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "mohammed-el-baraka/KhulasaAI",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use mohammed-el-baraka/KhulasaAI with Docker Model Runner:
docker model run hf.co/mohammed-el-baraka/KhulasaAI
A LoRA adapter for Qwen2.5-0.5B-Instruct fine-tuned on Arabic text summarization via Knowledge Distillation from Qwen2.5-7B-Instruct.
| Property | Value |
|---|---|
| Base Model | Qwen/Qwen2.5-0.5B-Instruct (494M parameters) |
| Teacher Model | Qwen/Qwen2.5-7B-Instruct |
| Method | QLoRA (r=16, ฮฑ=32, dropout=0.05) |
| Target Modules | q_proj, k_proj, v_proj, o_proj |
| Language | Arabic (Modern Standard Arabic) |
| Task | Abstractive Text Summarization |
| Adapter Size | 8.3 MB |
| License | MIT |
wikimedia/wikipedia, 20231101.ar)| Metric | Score |
|---|---|
| ROUGE-1 | 62.21 |
| ROUGE-2 | 41.17 |
| ROUGE-L | 60.66 |
| BERTScore (F1) | 0.861 |
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch
# Load model
base_model_id = "Qwen/Qwen2.5-0.5B-Instruct"
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
model = AutoModelForCausalLM.from_pretrained(base_model_id, torch_dtype=torch.float16, device_map="auto")
model = PeftModel.from_pretrained(model, "mohammed-el-baraka/KhulasaAI")
# Summarize
text = "your Arabic text here..."
messages = [
{"role": "system", "content": "ูุฎุต ุงููุต ุงูุชุงูู."},
{"role": "user", "content": f"ุงููุต: {text}\n\nุงูู
ูุฎุต:"}
]
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(inputs.to(model.device), max_new_tokens=150, temperature=0.7, do_sample=True)
summary = tokenizer.decode(outputs[0], skip_special_tokens=True).split("assistant")[-1].strip()
print(summary)
max_new_tokens constraint during annotation.@misc{elbaraka2026khulasaai,
title={KhulasaAI: Arabic Text Summarization via Knowledge Distillation},
author={Mohammed El Baraka},
year={2026},
month={january},
howpublished={\url{https://github.com/mohammed-el-baraka/KhulasaAI}}
}
Mohammed El Baraka โ University Mohammed VI Polytechnic (UM6P)