Update README.md
Browse files
README.md
CHANGED
@@ -1,191 +1,136 @@
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
# Model Card for Model ID
|
7 |
|
8 |
-
|
9 |
|
|
|
|
|
|
|
10 |
|
11 |
|
12 |
-
## Model Details
|
13 |
|
14 |
### Model Description
|
15 |
|
16 |
<!-- Provide a longer summary of what this model is. -->
|
17 |
|
18 |
-
|
|
|
|
|
|
|
19 |
|
20 |
-
- **Developed by:** [More Information Needed]
|
21 |
-
- **Funded by [optional]:** [More Information Needed]
|
22 |
-
- **Shared by [optional]:** [More Information Needed]
|
23 |
-
- **Model type:** [More Information Needed]
|
24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
25 |
-
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
|
28 |
-
### Model Sources
|
29 |
|
30 |
<!-- Provide the basic links for the model. -->
|
|
|
|
|
|
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
|
36 |
-
##
|
37 |
-
|
38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
39 |
-
|
40 |
-
### Direct Use
|
41 |
-
|
42 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
43 |
-
|
44 |
-
[More Information Needed]
|
45 |
-
|
46 |
-
### Downstream Use [optional]
|
47 |
-
|
48 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
49 |
-
|
50 |
-
[More Information Needed]
|
51 |
-
|
52 |
-
### Out-of-Scope Use
|
53 |
-
|
54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
55 |
-
|
56 |
-
[More Information Needed]
|
57 |
-
|
58 |
-
## Bias, Risks, and Limitations
|
59 |
-
|
60 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
61 |
|
62 |
-
|
|
|
63 |
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
-
|
67 |
|
68 |
-
|
69 |
|
70 |
-
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
[More Information Needed]
|
75 |
|
76 |
## Training Details
|
77 |
|
78 |
### Training Data
|
79 |
|
80 |
-
|
81 |
|
82 |
-
|
83 |
|
84 |
-
|
85 |
|
86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
87 |
-
|
88 |
-
#### Preprocessing [optional]
|
89 |
-
|
90 |
-
[More Information Needed]
|
91 |
|
92 |
|
93 |
#### Training Hyperparameters
|
94 |
|
95 |
-
- **Training regime:**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
#### Speeds, Sizes, Times [optional]
|
98 |
|
99 |
-
|
100 |
|
101 |
-
[More Information Needed]
|
102 |
|
103 |
## Evaluation
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
### Testing Data, Factors & Metrics
|
108 |
-
|
109 |
-
#### Testing Data
|
110 |
-
|
111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
112 |
-
|
113 |
-
[More Information Needed]
|
114 |
|
115 |
#### Factors
|
116 |
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
|
121 |
#### Metrics
|
122 |
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
|
127 |
### Results
|
128 |
|
129 |
-
|
|
|
130 |
|
131 |
#### Summary
|
|
|
132 |
|
133 |
|
134 |
-
|
135 |
-
## Model Examination [optional]
|
136 |
-
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
-
|
141 |
-
## Environmental Impact
|
142 |
-
|
143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
-
|
145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
146 |
-
|
147 |
-
- **Hardware Type:** [More Information Needed]
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
-
|
153 |
-
## Technical Specifications [optional]
|
154 |
-
|
155 |
-
### Model Architecture and Objective
|
156 |
-
|
157 |
-
[More Information Needed]
|
158 |
-
|
159 |
-
### Compute Infrastructure
|
160 |
-
|
161 |
-
[More Information Needed]
|
162 |
-
|
163 |
-
#### Hardware
|
164 |
-
|
165 |
-
[More Information Needed]
|
166 |
-
|
167 |
-
#### Software
|
168 |
-
|
169 |
-
[More Information Needed]
|
170 |
-
|
171 |
-
## Citation [optional]
|
172 |
-
|
173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
-
|
175 |
-
**BibTeX:**
|
176 |
-
|
177 |
-
[More Information Needed]
|
178 |
-
|
179 |
-
**APA:**
|
180 |
-
|
181 |
-
[More Information Needed]
|
182 |
-
|
183 |
-
## Glossary [optional]
|
184 |
-
|
185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
## More Information [optional]
|
190 |
|
191 |
[More Information Needed]
|
@@ -196,4 +141,5 @@ Carbon emissions can be estimated using the [Machine Learning Impact calculator]
|
|
196 |
|
197 |
## Model Card Contact
|
198 |
|
199 |
-
[More Information Needed]
|
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
+
language:
|
4 |
+
- ru
|
5 |
+
- lez
|
6 |
+
license: apache-2.0
|
7 |
+
datasets:
|
8 |
+
- leks-forever/bible-lezghian-russian
|
9 |
+
metrics:
|
10 |
+
- bleu
|
11 |
+
base_model:
|
12 |
+
- google/mt5-base
|
13 |
+
pipeline_tag: translation
|
14 |
+
tags:
|
15 |
+
- translation
|
16 |
+
- lezghian
|
17 |
+
- caucasus
|
18 |
+
- mt5-base
|
19 |
---
|
20 |
|
21 |
# Model Card for Model ID
|
22 |
|
23 |
+
This version of the Google T5-Base model has been fine-tuned on a bilingual dataset of Russian and Lezgian sentences to improve translation quality in both directions (from Russian to Lezgian and from Lezgian to Russian). The model is designed to provide accurate and high-quality translations between these two languages.
|
24 |
|
25 |
+
* Architecture: Sequence-to-Sequence Transformer.
|
26 |
+
* Languages Supported: Russian and Lezghian. The fine-tuning focuses on enhancing the accuracy of translations in both directions.
|
27 |
+
* Use Cases: The model is suitable for machine translation tasks between Russian and Lezgian, as well as for applications requiring automated translations in these language pairs, such as support systems, chatbots, or content localization.
|
28 |
|
29 |
|
|
|
30 |
|
31 |
### Model Description
|
32 |
|
33 |
<!-- Provide a longer summary of what this model is. -->
|
34 |
|
35 |
+
- **Developed by:** Leks Forever Team
|
36 |
+
- **Language(s) (NLP):** Lezghian, Russian
|
37 |
+
<!-- - **License:** [More Information Needed] -->
|
38 |
+
- **Finetuned from model:** [google/mt5-base](https://huggingface.co/google/mt5-base)
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
+
### Model Sources
|
42 |
|
43 |
<!-- Provide the basic links for the model. -->
|
44 |
+
- **Repository:** https://github.com/leks-forever/t5-tuning
|
45 |
+
<!-- - **Paper [optional]:** [More Information Needed] -->
|
46 |
+
<!-- - **Demo [optional]:** [More Information Needed] -->
|
47 |
|
48 |
+
### Model Prefixes
|
49 |
+
`"translate Russian to Lezghian: "` - Ru-Lez
|
50 |
+
`"translate Lezghian to Russian: "` - Lez-Ru
|
51 |
|
52 |
+
## How to Get Started with the Model
|
53 |
+
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("leks-forever/mt5-base")
|
56 |
+
tokenizer = AutoTokenizer.from_pretrained("leks-forever/mt5-base")
|
57 |
|
58 |
+
```python
|
59 |
+
def predict(text, prefix, a=32, b=3, max_input_length=1024, num_beams=1, **kwargs):
|
60 |
+
inputs = tokenizer(prefix + text, return_tensors='pt', padding=True, truncation=True, max_length=max_input_length)
|
61 |
+
result = model.generate(
|
62 |
+
**inputs.to(model.device),
|
63 |
+
max_new_tokens=int(a + b * inputs.input_ids.shape[1]),
|
64 |
+
num_beams=num_beams,
|
65 |
+
**kwargs
|
66 |
+
)
|
67 |
+
return tokenizer.batch_decode(result, skip_special_tokens=True)
|
68 |
|
69 |
+
sentence: str = "Римдин аскерар ва гьакӀни чӀехи хахамрини фарисейри ракъурнавай нуькерар Ягьуд галаз багъдиз атана. Абурув виридав яракьар, чирагъар ва шемгьалар гвай."
|
70 |
|
71 |
+
translation = predict(sentence, prefix="translate Lezghian to Russian: ")
|
72 |
|
73 |
+
print(translation)
|
74 |
|
75 |
+
# ['Когда римские воины и вожди, а также главные священнослужители и блюстители Закона пришли в Иудею, они дали ему вооружённые оружие, б��аслеты и серьги.']
|
76 |
+
```
|
|
|
77 |
|
78 |
## Training Details
|
79 |
|
80 |
### Training Data
|
81 |
|
82 |
+
The model was fine-tuned on the [bible-lezghian-russian](https://huggingface.co/datasets/leks-forever/bible-lezghian-russian) dataset, which contains 13,800 parallel sentences in Russian and Lezgian. The dataset was split into three parts: 90% for training, 5% for validation, and 5% for testing.
|
83 |
|
84 |
+
### Preprocessing
|
85 |
|
86 |
+
The preprocessing step included tokenization with a custom-trained SentencePiece NLLB-based tokenizer on the Russian-Lezgian corpus.
|
87 |
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
|
90 |
#### Training Hyperparameters
|
91 |
|
92 |
+
- **Training regime:** fp32
|
93 |
+
- **Batch size:** 16
|
94 |
+
- **Training steps:** The model converged on 14k out of 110000k steps
|
95 |
+
- **Optimizer:** Adafactor with the following settings:
|
96 |
+
- **lr:** 1e-4
|
97 |
+
- **scale_parameter:** False
|
98 |
+
- **relative_step:** False
|
99 |
+
- **clip_threshold:** 1.0
|
100 |
+
- **weight_decay:** 1e-3
|
101 |
+
- **Scheduler:** Cosine scheduler with a warmup of 1,000 steps
|
102 |
|
103 |
#### Speeds, Sizes, Times [optional]
|
104 |
|
105 |
+
- **Training time:** 2 hours on a single NVIDIA RTX5000 (24 GB).
|
106 |
|
|
|
107 |
|
108 |
## Evaluation
|
109 |
|
110 |
+
The evaluation was conducted on the val set of the [bible-lezghian-russian](https://huggingface.co/datasets/leks-forever/bible-lezghian-russian) dataset, consisting of 5% of the total 13,800 parallel sentences.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
#### Factors
|
113 |
|
114 |
+
The evaluation considered translations in both directions:
|
115 |
+
* Lezgian to Russian
|
116 |
+
* Russian to Lezgian
|
117 |
|
118 |
#### Metrics
|
119 |
|
120 |
+
The following metrics were used to evaluate the model’s performance:
|
121 |
+
* BLEU (n-grams = 4): This metric measures the accuracy of the machine translation output by comparing it to human translations. A higher score indicates better performance.
|
122 |
+
* chrF: This is a character-level metric that evaluates the quality of translation by comparing the overlap of character n-grams between the hypothesis and the reference. It’s effective for morphologically rich languages.
|
123 |
|
124 |
### Results
|
125 |
|
126 |
+
* Lezgian to Russian: BLEU = 27, chrF = 61
|
127 |
+
* Russian to Lezgian: BLEU = 27, chrF = 67
|
128 |
|
129 |
#### Summary
|
130 |
+
These results indicate that the model can produce accurate translations for both language pairs. However, there are plans to improve the model further by conducting parallel alignment of the corpora to refine the sentence pair matching. Additionally, efforts will be made to collect more training data to enhance the model's performance, especially in handling more diverse and complex linguistic structures.
|
131 |
|
132 |
|
133 |
+
<!--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
## More Information [optional]
|
135 |
|
136 |
[More Information Needed]
|
|
|
141 |
|
142 |
## Model Card Contact
|
143 |
|
144 |
+
[More Information Needed]
|
145 |
+
-->
|