kingabzpro
commited on
Commit
•
6425937
1
Parent(s):
c9c1753
adding Yml into model card and prediction discription.
Browse files
README.md
CHANGED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: Yorùbá, English
|
3 |
+
datasets:
|
4 |
+
- AI4D-Africa - Yorùbá Machine Translation Challenge
|
5 |
+
tags:
|
6 |
+
- text
|
7 |
+
- machine-translation
|
8 |
+
- language-translation
|
9 |
+
- seq2seq
|
10 |
+
- helsinki-nlp
|
11 |
+
license: apache-2.0
|
12 |
+
metrics:
|
13 |
+
- ROUGE
|
14 |
+
---
|
15 |
+
## Predicting English Translation
|
16 |
+
```python
|
17 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
18 |
+
|
19 |
+
# Loading tokenizer and model
|
20 |
+
tokenizer = AutoTokenizer.from_pretrained("kingabzpro/Helsinki-NLP-opus-yor-mul-en")
|
21 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("kingabzpro/Helsinki-NLP-opus-yor-mul-en").to('cuda')
|
22 |
+
|
23 |
+
# Prediction
|
24 |
+
a = model.generate(**tokenizer.prepare_seq2seq_batch('Nínú ìpè kan lẹ́yìn ìgbà náà, wọ́n sọ fún aṣojú iléeṣẹ́ BlaBlaCar pé ètò náà ti yí padà, pé',return_tensors='pt').to('cuda'))
|
25 |
+
text = tokenizer.batch_decode(a)
|
26 |
+
|
27 |
+
# Cleaning text
|
28 |
+
text = str(text)
|
29 |
+
text = re.sub("<pad> ","",text)
|
30 |
+
text = re.sub("'","",text)
|
31 |
+
text = text.replace("[", "")
|
32 |
+
text = text.replace("]", "")
|
33 |
+
text
|
34 |
+
```
|
35 |
+
## Result
|
36 |
+
```
|
37 |
+
'In a statement after that hearing, the BualaCard’s representative was told that the event had changed, that he had turned up.'
|
38 |
+
```
|
39 |
+
## ROGUE Score
|
40 |
+
**0.3025**
|