Downloads · 30 days
0
Yamemaru/gemma-3-4b-Darija
gemma-3-4b-Darija is a text generation model from Yamemaru. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
A fine-tuned version of Google's Gemma-3-4b model specialized for Moroccan Darija language translation. This model can translate between English and Darija, providing both Arabic script and Latin transliteration.
Downloads · 30 days
0
Access
Public
Updated Mar 18, 2025
Repo size
278 MB
Likes
1
Public
Click a slice to open those files.
.safetensors240 MB · 86%
From the Hugging Face model README
A fine-tuned version of Google's Gemma-3-4b model specialized for Moroccan Darija language translation. This model can translate between English and Darija, providing both Arabic script and Latin transliteration.
Gemma-3-4b-Darija is a fine-tuned version of the Google Gemma-3-4b instruction-tuned model, specifically trained to handle translations and language tasks in Moroccan Darija. The model maintains the reasoning capabilities of the base model while adding specialized knowledge of the Darija dialect.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load model and tokenizer
model_name = "Yamemaru/gemma-3-4b-Darija"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float16, # Use float16 for efficiency
device_map="auto"
)
# Create messages
messages = [{
"role": "user",
"content": [{"type": "text", "text": "How do you say 'Hello, how are you?' in Moroccan Darija?"}]
}]
# Apply chat template for generation
text = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True
)
# Generate response
inputs = tokenizer([text], return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=128,
temperature=1.0,
top_p=0.95,
top_k=64
)
# Print the response
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
This model was fine-tuned using the Unsloth library with QLoRA techniques on the atlasia/Atlaset dataset. Training specifications:
This model is subject to the license of the original Gemma-3-4B model.