guymorlan/levanti
Preview • Updated • 104 • 8
How to use guymorlan/levanti_translate_en_ar with Transformers:
# Use a pipeline as a high-level helper
# Warning: Pipeline type "translation" is no longer supported in transformers v5.
# You must load the model directly (see below) or downgrade to v4.x with:
# 'pip install "transformers<5.0.0'
from transformers import pipeline
pipe = pipeline("translation", model="guymorlan/levanti_translate_en_ar") # Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("guymorlan/levanti_translate_en_ar")
model = AutoModelForSeq2SeqLM.from_pretrained("guymorlan/levanti_translate_en_ar")Trained on the Levanti dataset by fine-tuning Helsinki-NLP/opus-mt-en-ar for 8 epochs. This model is trained to support dialect conditional generation by utilizing the first token (followed by a space) as an indicator of the desired dialect:
from transformers import pipeline
trans = pipeline("translation", "guymorlan/levanti_translate_en_ar")
trans("P I wanna go to the store tomorrow")
Out[1]: [{'translation_text': 'بدي أروح ع الدكان بكرا'}]
Created by Guy Mor-Lan.
Contact: guy.mor AT mail.huji.ac.il