Text Generation
Transformers
Safetensors
Arabic
llama
arabic
education
storytelling
arabathon
allam
conversational
text-generation-inference
Instructions to use itsdevruba/midad-allam-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use itsdevruba/midad-allam-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="itsdevruba/midad-allam-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("itsdevruba/midad-allam-7b") model = AutoModelForCausalLM.from_pretrained("itsdevruba/midad-allam-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 itsdevruba/midad-allam-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "itsdevruba/midad-allam-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": "itsdevruba/midad-allam-7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/itsdevruba/midad-allam-7b
- SGLang
How to use itsdevruba/midad-allam-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 "itsdevruba/midad-allam-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": "itsdevruba/midad-allam-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 "itsdevruba/midad-allam-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": "itsdevruba/midad-allam-7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use itsdevruba/midad-allam-7b with Docker Model Runner:
docker model run hf.co/itsdevruba/midad-allam-7b
مداد (Midad) - ALLaM-7B
نموذج مدرّب لتحويل الدروس الدراسية إلى قصص ومغامرات تفاعلية بالفصحى بسياق سعودي، يكون فيها الطالب بطل القصة. تم تطويره ضمن هاكاثون عربثون.
التدريب
- النموذج الأساسي: ALLaM-7B-Instruct-preview
- الطريقة: LoRA لمدة 3 epochs، ثم دمج الأدابتر مع النموذج الأساسي (merged full model)
- كود التدريب: https://www.kaggle.com/code/lama377/midad-allam-finetune
- الواجهة: https://github.com/itsdevruba/Medad
طريقة الاستخدام
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = 'itsdevruba/midad-allam-7b'
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, device_map='auto', torch_dtype='auto')
msgs = [{'role': 'user', 'content': 'حوّل درس دورة الماء إلى قصة تفاعلية'}]
x = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors='pt').to(model.device)
out = model.generate(x, max_new_tokens=800, eos_token_id=tok.eos_token_id, pad_token_id=tok.eos_token_id, repetition_penalty=1.1)
print(tok.decode(out[0][x.shape[1]:], skip_special_tokens=True))
ملاحظة: تمرير eos_token_id ضروري لتجنّب تكرار المخرجات.
- Downloads last month
- 415