NightPrince/islamic-arabic-qa
Viewer • Updated • 21.1k • 39
How to use NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit with MLX:
# Make sure mlx-lm is installed
# pip install --upgrade mlx-lm
# Generate text with mlx-lm
from mlx_lm import load, generate
model, tokenizer = load("NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit")
prompt = "Write a story about Einstein"
messages = [{"role": "user", "content": prompt}]
prompt = tokenizer.apply_chat_template(
messages, add_generation_prompt=True
)
text = generate(model, tokenizer, prompt=prompt, verbose=True)How to use NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit with Pi:
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit"
# Install Pi:
npm install -g @mariozechner/pi-coding-agent
# Add to ~/.pi/agent/models.json:
{
"providers": {
"mlx-lm": {
"baseUrl": "http://localhost:8080/v1",
"api": "openai-completions",
"apiKey": "none",
"models": [
{
"id": "NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit"
}
]
}
}
}# Start Pi in your project directory: pi
How to use NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit with Hermes Agent:
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit"
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit
hermes
How to use NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit with OpenClaw:
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit"
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
openclaw agent --local --agent main --message "Hello from Hugging Face"
How to use NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit with MLX LM:
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit"
# Install MLX LM
uv tool install mlx-lm
# Start the server
mlx_lm.server --model "NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit"
# Calling the OpenAI-compatible server with curl
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit",
"messages": [
{"role": "user", "content": "Hello"}
]
}'MLX 4-bit quantized version of NightPrince/Qwen3-4B-Islamic-Arabic for native inference on Apple Silicon Macs.
Converted from the merged FP16 model using mlx-community/mlx-my-repo.
Trained by Yahya Alnwsany (NightPrince) on 17,944 Islamic Arabic Q&A pairs covering Fiqh, Fatwa, Aqeedah, Quran Sciences, and Islamic Finance.
| Variant | Repo | Description |
|---|---|---|
| Merged FP16 | NightPrince/Qwen3-4B-Islamic-Arabic | Canonical merged model — transformers / vLLM |
| LoRA Adapter | NightPrince/Qwen3-4B-Islamic-Arabic-LoRA | PEFT adapter, 264 MB |
| INT4 compressed-tensors | NightPrince/Qwen3-4B-Islamic-Arabic-INT4 | W4A16 for vLLM serving, 2.5 GB |
| GGUF | NightPrince/Qwen3-4B-Islamic-Arabic-GGUF | Q4_K_M / Q8_0 / F16 — Ollama / llama.cpp / LM Studio |
| MLX 4-bit (this model) | NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit | Apple Silicon native inference |
| Dataset | NightPrince/islamic-arabic-qa | 21,087 Islamic Arabic Q&A pairs |
pip install mlx-lm
from mlx_lm import load, generate
model, tokenizer = load("NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit")
messages = [
{
"role": "system",
"content": (
"أنت مساعد عالم إسلامي متخصص. أجب على الأسئلة بدقة استناداً إلى "
"القرآن الكريم والسنة النبوية والفقه الإسلامي الكلاسيكي. "
"استشهد بالمصادر حيثما أمكن. كن موجزاً لكن شاملاً."
),
},
{"role": "user", "content": "ما حكم زكاة الفطر وما مقدارها؟"},
]
prompt = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
response = generate(model, tokenizer, prompt=prompt, max_tokens=512, verbose=True)
mlx_lm.generate --model NightPrince/Qwen3-4B-Islamic-Arabic-mlx-4Bit --prompt "ما حكم زكاة الفطر؟" --max-tokens 512
| RAM | Notes |
|---|---|
| 8 GB | Minimum — works but tight |
| 16 GB | Recommended |
| 32 GB+ | Comfortable with long contexts |
@misc{qwen3-4b-islamic-arabic,
author = {Yahya Alnwsany},
title = {Qwen3-4B Islamic Arabic},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/NightPrince/Qwen3-4B-Islamic-Arabic},
}
Apache 2.0 — inherited from the base model and primary training dataset.
4-bit