Translation
Transformers
Safetensors
English
Arabic
marian
text2text-generation
NLP
Egyptian Arabic
English-Arabic
Instructions to use Omar-youssef/english-egyptian-arabic-translator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Omar-youssef/english-egyptian-arabic-translator 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="Omar-youssef/english-egyptian-arabic-translator")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("Omar-youssef/english-egyptian-arabic-translator") model = AutoModelForSeq2SeqLM.from_pretrained("Omar-youssef/english-egyptian-arabic-translator", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -63,18 +63,21 @@ This model is designed for translating English content into colloquial Egyptian
|
|
| 63 |
Use the code below to get started with the model:
|
| 64 |
|
| 65 |
```python
|
| 66 |
-
from transformers import
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
| 78 |
```
|
| 79 |
|
| 80 |
## Training Details
|
|
|
|
| 63 |
Use the code below to get started with the model:
|
| 64 |
|
| 65 |
```python
|
| 66 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 67 |
+
|
| 68 |
+
tokenizer = AutoTokenizer.from_pretrained("Omar-youssef/english-egyptian-arabic-translator")
|
| 69 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("Omar-youssef/english-egyptian-arabic-translator")
|
| 70 |
+
|
| 71 |
+
def translate(text):
|
| 72 |
+
inputs = tokenizer.encode(text, return_tensors="pt")
|
| 73 |
+
outputs = model.generate(inputs, num_beams=4, early_stopping=True)
|
| 74 |
+
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 75 |
+
|
| 76 |
+
print(translate("We haven't seen each other in a long time. We should catch up soon."))
|
| 77 |
+
# Output: إحنا مش بنشوف بعض من فترة طويلة. المفروض نلحق ببعضنا قريب.
|
| 78 |
+
|
| 79 |
+
print(translate("It's getting cold outside, so take a jacket with you."))
|
| 80 |
+
# Output: الجو طلع برد بره، فاخد جاكيت معاك.
|
| 81 |
```
|
| 82 |
|
| 83 |
## Training Details
|