72 lines
2.2 KiB
Markdown
72 lines
2.2 KiB
Markdown
|
|
---
|
||
|
|
license: apache-2.0
|
||
|
|
datasets:
|
||
|
|
- 24-mohamedyehia/gloss2text-Ar-sft
|
||
|
|
language:
|
||
|
|
- ar
|
||
|
|
base_model:
|
||
|
|
- google/gemma-3-270m-it
|
||
|
|
pipeline_tag: text-generation
|
||
|
|
tags:
|
||
|
|
- sign-language
|
||
|
|
- arabic
|
||
|
|
- ArSL
|
||
|
|
- gloss-to-text
|
||
|
|
- gemma-3
|
||
|
|
- accessibility
|
||
|
|
---
|
||
|
|
|
||
|
|
# Gloss2Text-V1-Gemma3-270M (Merged)
|
||
|
|
|
||
|
|
## Overview
|
||
|
|
**Gloss2Text-V1-Gemma3-270M** is a fine-tuned version of Google's **Gemma-3-270m-it**, optimized for **Arabic Sign Language (ArSL) gloss-to-text translation**.
|
||
|
|
|
||
|
|
This release is **merged**, which means the LoRA adapters have already been fused into the base model weights for faster inference and easier plug-and-play usage.
|
||
|
|
|
||
|
|
## Model Description
|
||
|
|
- **Task:** Converts a sequence of Arabic glosses into a natural, grammatically correct Modern Standard Arabic (MSA) sentence.
|
||
|
|
- **Input format:** Arabic gloss text, for example: "أنا شرب ماء الآن"
|
||
|
|
- **Output format:** Clean MSA text, for example: "أنا أشرب الماء الآن."
|
||
|
|
- **Architecture:** Gemma-3, 270M parameters
|
||
|
|
- **Training method:** Supervised fine-tuning with LoRA (rank 64), then merged
|
||
|
|
|
||
|
|
## Training Highlights
|
||
|
|
The model was trained on a specialized dataset containing diverse ArSL gloss-sentence pairs.
|
||
|
|
- **Final eval loss:** ~0.34
|
||
|
|
- **Precision:** Trained with `bf16` for improved numerical stability
|
||
|
|
|
||
|
|
|
||
|
|
## How to Use
|
||
|
|
Because this is a merged model, you can load it directly with the `transformers` library without needing `peft`:
|
||
|
|
|
||
|
|
```python
|
||
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||
|
|
import torch
|
||
|
|
|
||
|
|
model_id = "24-mohamedyehia/Gloss2Text-V1-Gemma3-270M"
|
||
|
|
|
||
|
|
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
||
|
|
model = AutoModelForCausalLM.from_pretrained(
|
||
|
|
model_id,
|
||
|
|
torch_dtype=torch.bfloat16,
|
||
|
|
device_map="auto",
|
||
|
|
)
|
||
|
|
|
||
|
|
def translate_gloss(gloss_text):
|
||
|
|
prompt = f"Translate ArSL gloss to an MSA sentence.\nGloss: {gloss_text}\nOutput: "
|
||
|
|
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
||
|
|
outputs = model.generate(**inputs, max_new_tokens=50)
|
||
|
|
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
||
|
|
|
||
|
|
|
||
|
|
# Example
|
||
|
|
print(translate_gloss("أنا ذهاب صيدلية"))
|
||
|
|
```
|
||
|
|
|
||
|
|
|
||
|
|
## Developer
|
||
|
|
|
||
|
|
Developed by **Mohamed Yehia**.
|
||
|
|
|
||
|
|
- **LinkedIn:** [Mohamed Yehia](https://www.linkedin.com/in/24-mohamed-yehia/)
|