Text Generation
Transformers
Safetensors
Arabic
English
falcon_h1
medical
medical-qa
arabic
egyptian-arabic
gulf-arabic
falcon-h1
mamba
hybrid-ssm
reasoning
conversational
Eval Results (legacy)
Instructions to use Vionex-digital/Hakeem-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Vionex-digital/Hakeem-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Vionex-digital/Hakeem-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Vionex-digital/Hakeem-7B") model = AutoModelForCausalLM.from_pretrained("Vionex-digital/Hakeem-7B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Vionex-digital/Hakeem-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Vionex-digital/Hakeem-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Vionex-digital/Hakeem-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Vionex-digital/Hakeem-7B
- SGLang
How to use Vionex-digital/Hakeem-7B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Vionex-digital/Hakeem-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Vionex-digital/Hakeem-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
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 "Vionex-digital/Hakeem-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Vionex-digital/Hakeem-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Vionex-digital/Hakeem-7B with Docker Model Runner:
docker model run hf.co/Vionex-digital/Hakeem-7B
Download deploy/hakeem_web.py from Vionex-digital/Hakeem-7B: direct link, hf CLI and curl.
- Browser
- Download file 2.73 kB
-
https://huggingface.co/Vionex-digital/Hakeem-7B/resolve/main/deploy/hakeem_web.py
- Command line
-
hf download hf://Vionex-digital/Hakeem-7B/deploy/hakeem_web.py
-
curl -L -o hakeem_web.py https://huggingface.co/Vionex-digital/Hakeem-7B/resolve/main/deploy/hakeem_web.py
2.73 kB
| """Hakeem-7B browser chat — THINK-FIRST default (shows its reasoning, then the final answer). | |
| Identity card served as system prompt. Public gradio share link.""" | |
| import json, torch, gradio as gr | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| MODEL = "/home/ubuntu/ar-medr/checkpoints/hakeem_idcard_v1" | |
| CARD = "/home/ubuntu/ar-medr/hakeem_identity_card.json" | |
| card = json.load(open(CARD)) | |
| print("loading model...", flush=True) | |
| tok = AutoTokenizer.from_pretrained(MODEL) | |
| model = AutoModelForCausalLM.from_pretrained(MODEL, dtype=torch.bfloat16, device_map="cuda:0").eval() | |
| print("model ready.", flush=True) | |
| def _is_en(s): | |
| al = [c for c in s if c.isalpha()] | |
| return bool(al) and sum(c.isascii() for c in al) > 0.5 * len(al) | |
| def answer(q, max_new=512): | |
| en = _is_en(q) | |
| head = (card["en"] if en else card["ar"]) + "\n\n" | |
| body = ("User question: " + q + "\nThink step by step, then give your final answer clearly.\nHakeem's reasoning:") if en \ | |
| else ("سؤال المستخدم: " + q + "\nفكّر خطوة بخطوة، ثم اكتب الإجابة النهائية بوضوح.\nتفكير حكيم:") | |
| ids = tok(head + body, return_tensors="pt").to("cuda:0") | |
| with torch.no_grad(): | |
| out = model.generate(**ids, max_new_tokens=max_new, do_sample=False, pad_token_id=tok.eos_token_id) | |
| return tok.decode(out[0][ids.input_ids.shape[1]:], skip_special_tokens=True).strip() | |
| def respond(message, history): | |
| return answer(message) # single-turn: card + question, think-first, answered fresh | |
| demo = gr.ChatInterface( | |
| respond, | |
| title="حكيم · Hakeem-7B — Arabic Medical AI (think-first) · Vionex Digital Solutions", | |
| description=("يفكّر خطوة بخطوة ثم يكتب الإجابة النهائية. Reasons step-by-step, then answers. " | |
| "اسأل بالعربي الفصحى أو المصري أو الإنجليزي. " | |
| "⚠️ Research preview — reasoning may contain factual errors; not for real clinical decisions."), | |
| examples=[ | |
| "مريض عنده ضغط مرتفع وسكري نوع 2، ما أنسب دواء لخفض الضغط ولماذا؟", | |
| "ابني وزنه ١٥ كيلو وعنده سخونية، أديله كام مللي باراسيتامول شراب؟", | |
| "أنا باخد وارفارين، ينفع آخد بنادول للصداع؟", | |
| "ما الفرق بين الباراسيتامول والإيبوبروفين، ومتى أُفضّل كل منهما؟", | |
| "إنت مين بالظبط؟ وإنت زي ChatGPT ولا فيه فرق؟", | |
| ], | |
| ) | |
| if __name__ == "__main__": | |
| demo.queue().launch(share=True, server_name="0.0.0.0", server_port=7860) | |