Text Generation
Transformers
Safetensors
qwen3_5
image-text-to-text
translation
machine-translation
african-languages
multilingual
conversational
qwen3.5
Instructions to use qvac/TranslatePsy-AfriSLM-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use qvac/TranslatePsy-AfriSLM-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="qvac/TranslatePsy-AfriSLM-4B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("qvac/TranslatePsy-AfriSLM-4B") model = AutoModelForMultimodalLM.from_pretrained("qvac/TranslatePsy-AfriSLM-4B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use qvac/TranslatePsy-AfriSLM-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "qvac/TranslatePsy-AfriSLM-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "qvac/TranslatePsy-AfriSLM-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/qvac/TranslatePsy-AfriSLM-4B
- SGLang
How to use qvac/TranslatePsy-AfriSLM-4B 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 "qvac/TranslatePsy-AfriSLM-4B" \ --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": "qvac/TranslatePsy-AfriSLM-4B", "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 "qvac/TranslatePsy-AfriSLM-4B" \ --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": "qvac/TranslatePsy-AfriSLM-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use qvac/TranslatePsy-AfriSLM-4B with Docker Model Runner:
docker model run hf.co/qvac/TranslatePsy-AfriSLM-4B
Add a note to mention that the base model performance in high-resource languages is expected to be maintained.
Browse filesIn reply to a comment in Github (https://github.com/tether-ai-research/qvac-translatepsy-afri-slm/issues/1), add a note to mention that the base model performance in high-resource languages is expected to be maintained, with the example of modern standard Arabic.
README.md
CHANGED
|
@@ -107,6 +107,17 @@ The model was not designed or validated for autonomous use in medical, legal, em
|
|
| 107 |
|
| 108 |
Translation quality is not guaranteed for unsupported languages, dialects, specialized domains, code-switching, very long documents, or text requiring extensive cultural context. The model's multimodal capabilities were not evaluated after fine-tuning.
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
## How to Get Started
|
| 111 |
|
| 112 |
Qwen3.5 requires Transformers 5. Use a recent version of `transformers`:
|
|
|
|
| 107 |
|
| 108 |
Translation quality is not guaranteed for unsupported languages, dialects, specialized domains, code-switching, very long documents, or text requiring extensive cultural context. The model's multimodal capabilities were not evaluated after fine-tuning.
|
| 109 |
|
| 110 |
+
Despite these limitations, training included parallel data in Arabic as well as Asian and European languages to limit catastrophic forgetting.
|
| 111 |
+
Consequently, the model maintains reasonable performance outside the primary targeted language pairs.
|
| 112 |
+
For example, as shown in the MetricX-24 scores on the FLORES-200 benchmark for Modern Standard Arabic (lower is better; differences relative to the baseline Qwen3.5 model are in parentheses),
|
| 113 |
+
base model performance for this language pair was maintained, or even improved in the smaller variants:
|
| 114 |
+
|
| 115 |
+
| Model | ara-eng | eng-ara |
|
| 116 |
+
|---|---:|---:|
|
| 117 |
+
| TranslatePsy-AfriSLM-0.8B | 4.39 (-0.70) | 6.19 (-2.42) |
|
| 118 |
+
| TranslatePsy-AfriSLM-2B | 3.09 (-0.52) | 4.21 (-0.69) |
|
| 119 |
+
| TranslatePsy-AfriSLM-4B | 2.49 (+0.01) | 3.20 (+0.25) |
|
| 120 |
+
|
| 121 |
## How to Get Started
|
| 122 |
|
| 123 |
Qwen3.5 requires Transformers 5. Use a recent version of `transformers`:
|