arbml/CIDAR
Viewer • Updated • 10k • 1.5k • 57
How to use Kandil7/Baligh-1.7B with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Kandil7/Baligh-1.7B") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Kandil7/Baligh-1.7B")
model = AutoModelForCausalLM.from_pretrained("Kandil7/Baligh-1.7B", device_map="auto")How to use Kandil7/Baligh-1.7B with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Kandil7/Baligh-1.7B"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Kandil7/Baligh-1.7B",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/Kandil7/Baligh-1.7B
How to use Kandil7/Baligh-1.7B with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Kandil7/Baligh-1.7B" \
--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": "Kandil7/Baligh-1.7B",
"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 "Kandil7/Baligh-1.7B" \
--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": "Kandil7/Baligh-1.7B",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use Kandil7/Baligh-1.7B with Docker Model Runner:
docker model run hf.co/Kandil7/Baligh-1.7B
الفصاحية والذكاء — Fluency and Intelligence
Baligh-1.7B v0 is an Arabic-first language model with Islamic knowledge specialization, fine-tuned from unsloth/Qwen3-1.7B-Base via Continued Pretraining (CPT) and Supervised Fine-Tuning (SFT) using QLoRA 4-bit.
| Attribute | Value |
|---|---|
| Model Type | Causal Language Model (merged instruct, FP16) |
| Base Model | unsloth/Qwen3-1.7B-Base |
| Total Parameters | 1.7B (1.4B non-embedding) |
| Architecture | 28 layers, GQA (16 query / 8 KV heads), hidden size 2048 |
| Native Context | 32,768 tokens (architecture) |
| v0 Training Window | 2,048 tokens (no RoPE scaling applied yet) |
| Tokenizer | Qwen3 tokenizer (~152K vocab, unchanged for v0) |
| Languages | Arabic (primary, fusha), English |
| Domains | General Arabic, Islamic Knowledge (Quran, Hadith, Fiqh, Tafsir) |
| Precision | FP16 (Turing GPUs); bf16 auto-selected on Ampere+ |
| Attention | SDPA (flash_attention_2 auto-upgrade on sm_80+) |
{instruction, input, output} schema):sanitize() blanks non-Arabic text instead of dropping rows, preserving mixed-language instruction examples.fatwa_id group so no ruling appears in both train and eval.| Benchmark | Baseline | Post-SFT | Delta |
|---|---|---|---|
| CIDAR ROUGE-L | 0.0402 | 0.0543 | +35% |
| CIDAR BLEU | 2.28 | 1.32 | −42% |
Baligh-1.7B v0 is designed for:
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("Kandil7/Baligh-1.7B", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("Kandil7/Baligh-1.7B", trust_remote_code=True)
prompt = "ما هي أركان الإسلام؟"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.7)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
@software{baligh2026,
title={Baligh-1.7B: Arabic-first LLM with Islamic Knowledge Specialization},
author={Baligh Team},
year={2026},
url={https://huggingface.co/Kandil7/Baligh-1.7B}
}
Apache 2.0 — see LICENSE for details.