Instructions to use mohammedkhas/customized-ar-translator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use mohammedkhas/customized-ar-translator 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, "mohammedkhas/customized-ar-translator") - Transformers
How to use mohammedkhas/customized-ar-translator with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mohammedkhas/customized-ar-translator") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("mohammedkhas/customized-ar-translator", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mohammedkhas/customized-ar-translator with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mohammedkhas/customized-ar-translator" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mohammedkhas/customized-ar-translator", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mohammedkhas/customized-ar-translator
- SGLang
How to use mohammedkhas/customized-ar-translator 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 "mohammedkhas/customized-ar-translator" \ --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": "mohammedkhas/customized-ar-translator", "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 "mohammedkhas/customized-ar-translator" \ --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": "mohammedkhas/customized-ar-translator", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use mohammedkhas/customized-ar-translator with Docker Model Runner:
docker model run hf.co/mohammedkhas/customized-ar-translator
customized-ar-translator
This model is a fine-tuned version of Qwen/Qwen2.5-0.5B-Instruct on the trans_finetune_train dataset. It achieves the following results on the evaluation set:
- Loss: 0.8289
Model description
language: - ar - en tags: - translation - technical-translation - education - nlp license: apache-2.0
🤖 Tech-En-Ar-Translator-Glossary
Model Description
This model is a specialized English-to-Arabic translator designed specifically for the IT and Technology domain.
Unlike standard translators, this model does not translate technical jargon (like "Cloud Computing," "Servers," "Infrastructure") into obscure Arabic terms. Instead, it:
- Preserves Technical Terms: Keeps key English terminology within the Arabic sentence structure.
- HTML-Ready Output: Wraps the text in HTML tags (
dir="rtl",<span>) for immediate web rendering. - Auto-Glossary: Generates a separate "Explaining" section that defines the preserved English terms in Arabic.
It is designed for educational platforms, technical documentation, and learning management systems where students need to learn standard English IT terminology while reading in Arabic.
✨ Key Features
- Smart Code-Switching: Fluent Arabic grammar mixed with English technical nouns.
- Dual Output: Returns a JSON object containing the
translatedtext and theexplaining(glossary) text. - Frontend Friendly: Outputs sanitized HTML strings ready for integration into web apps (React, Vue, plain HTML).
🚀 Example Output
Input Text: > "Cloud computing is the delivery of IT resources including servers, storage, and databases over the internet."
Model Output (JSON):
'''json { "translated": "<div dir="rtl">إنترنت كمبيوتر (<span dir="ltr">Cloud computing) هو توصيل <span dir="ltr">IT resources، بما في ذلك موارد <span dir="ltr">servers و<span dir="ltr">storage و<span dir="ltr">databases، عبر الإنترنت مع أسعار <span dir="ltr">pay-as-you-go.", "explaining": "<div dir="rtl">Cloud computing: هي تقنية تسمح للمستخدمين ب Retrieving (توصيل) برامج وتطبيقات وبيانات...<div dir="rtl">servers: هي مكونات أساسية في نظام تشغيل كمبيوتر..." }'''
Intended uses & limitations
This model is fine-tuned specifically for IT contexts. It may not perform well on general conversational English (e.g., translating a novel or a poem).
The output includes HTML tags; if you need plain text, you will need to strip the tags post-processing.
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 0.0001
- train_batch_size: 3
- eval_batch_size: 1
- seed: 42
- gradient_accumulation_steps: 3
- total_train_batch_size: 9
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: cosine
- lr_scheduler_warmup_ratio: 0.1
- num_epochs: 3.0
Training results
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 1.251 | 0.2 | 10 | 1.1727 |
| 1.0906 | 0.4 | 20 | 1.0423 |
| 0.9856 | 0.6 | 30 | 0.9799 |
| 1.0287 | 0.8 | 40 | 0.9357 |
| 0.998 | 1.0 | 50 | 0.9081 |
| 0.7978 | 1.2 | 60 | 0.8900 |
| 0.7939 | 1.4 | 70 | 0.8629 |
| 0.7864 | 1.6 | 80 | 0.8529 |
| 0.7682 | 1.8 | 90 | 0.8424 |
| 0.7936 | 2.0 | 100 | 0.8330 |
| 0.6651 | 2.2 | 110 | 0.8357 |
| 0.6441 | 2.4 | 120 | 0.8340 |
| 0.6665 | 2.6 | 130 | 0.8300 |
| 0.6833 | 2.8 | 140 | 0.8287 |
| 0.691 | 3.0 | 150 | 0.8289 |
Framework versions
- PEFT 0.17.1
- Transformers 4.57.1
- Pytorch 2.9.0+cu126
- Datasets 4.0.0
- Tokenizers 0.22.1
- Downloads last month
- 14