|
--- |
|
language: |
|
- en |
|
- az |
|
tags: |
|
- machine-translation |
|
- mt5 |
|
- english |
|
- azerbaijani |
|
license: cc-by-nc-sa-4.0 |
|
widget: |
|
- text: >- |
|
Artificial intelligence is already superior to human learning in numerous |
|
domains. |
|
- text: Learn as if you will live forever, live like you will die tomorrow. |
|
- text: When you change your thoughts, remember to also change your world. |
|
pipeline_tag: translation |
|
inference: |
|
parameters: |
|
max_length: 128 |
|
num_return_sequences: 1 |
|
do_sample: false |
|
datasets: |
|
- learningmachineaz/translate_enaz_10m |
|
--- |
|
|
|
# Machine Translation (Maşın tərcüməsi) |
|
|
|
This is the most advanced and accurate mT5 based model for machine translation available as for Azerbaijani language.\ |
|
The model was trained on 10 million sentences extracted from various text sources of Azerbaijan National Library.\ |
|
Quality of translation is very close to Google Translate as it was used for English translations. |
|
|
|
## Text above translated using this model |
|
``` |
|
Bu, Azərbaycan dilinə olduğu kimi, maşın tərcüməsi üçün ən qabaqcıl və dəqiq mT5 əsaslı modeldir. |
|
Model Azərbaycan Milli Kitabxanasının müxtəlif mətn mənbələrindən çıxarılan 10 milyon cümlə üzrə təlim keçib. |
|
Tərcümə keyfiyyəti ingilis dilinə tərcümələr üçün istifadə olunduğundan Google Tərcümə ilə çox yaxındır. |
|
``` |
|
|
|
## Training |
|
|
|
| Key point | Info | |
|
|-------------------------|---------| |
|
| Base model | mT5-base | |
|
| Batch size | 16 | |
|
| Epochs | 10 | |
|
| Steps | 620k | |
|
| Training Loss | 0.56 | |
|
| Eval Loss | 0.53 | |
|
| Training Duration | 2 days | |
|
|
|
|
|
## Here is an example of how you can run inference: |
|
|
|
```python |
|
from transformers import MT5Tokenizer, MT5ForConditionalGeneration |
|
|
|
model_name = 'learningmachineaz/mt5-enaz-10m' |
|
max_length = 128 |
|
|
|
tokenizer = MT5Tokenizer.from_pretrained(model_name) |
|
model = MT5ForConditionalGeneration.from_pretrained(model_name) |
|
|
|
text = "Artificial intelligence is already superior to human learning in numerous domains." |
|
input_ids = tokenizer(f'translate English to Azerbaijani: {text}', return_tensors="pt").input_ids |
|
|
|
# OPTION 1 - SINGLE TRANSLATION |
|
outputs = model.generate(input_ids, max_length=max_length, do_sample=False, num_return_sequences=1) |
|
print(tokenizer.decode(outputs[0], skip_special_tokens=True)) |
|
|
|
# OPTION 2 - MULTIPLE VARIATIONS |
|
outputs = model.generate(input_ids, max_length=max_length, do_sample=True, top_k=10, num_return_sequences=3) |
|
for i, output in enumerate(outputs): |
|
print(tokenizer.decode(output, skip_special_tokens=True)) |
|
``` |
|
|
|
OPTION 1 - OUTPUT: |
|
``` |
|
Süni intellekt artıq çoxsaylı domenlərdə insanın öyrənilməsindən üstünlük təşkil edir. |
|
``` |
|
|
|
OPTION 2 - OUTPUT: |
|
``` |
|
Artıq çoxsaylı domenlərdə süni zəka insanın öyrənilməsindən daha üstün olması şərti ilə müşahidə edilir. |
|
Süni intellekt artıq çoxsaylı oblastlarda insanın təlimindən yüksəkdir. |
|
Süni intellekt artıq çoxsaylı domenlərdə insan öyrənməsindən daha üstün gəlir. |
|
``` |
|
|
|
## Author |
|
|
|
Trained and evaluated by [Renat Kalimulin](https://www.linkedin.com/in/rinat-kalimulin-16853358/) |