johnlockejrr commited on
Commit
fa65c54
·
verified ·
1 Parent(s): 1ccab5b

Upload 16 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ source.spm filter=lfs diff=lfs merge=lfs -text
37
+ target.spm filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,3 +1,268 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - syr
4
+ tags:
5
+ - translation
6
+ - syriac
7
+ - vocalization
8
+ - diacritics
9
+ - biblical
10
+ - eastern-syriac
11
+ - mossul
12
+ - seq2seq
13
+ - marianmt
14
+ license: apache-2.0
15
+ datasets:
16
+ - custom
17
+ metrics:
18
+ - bleu
19
+ - chrf
20
+ - accuracy
21
+ base_model: Helsinki-NLP/opus-mt-tc-bible-big-sem-en
22
+ model-index:
23
+ - name: johnlockejrr/marianmt_syr_voc_eastern
24
+ results:
25
+ - task:
26
+ type: text-to-text-generation
27
+ name: Eastern Syriac Vocalization
28
+ dataset:
29
+ name: Eastern Syriac Vocalization Dataset
30
+ type: custom
31
+ metrics:
32
+ - type: bleu
33
+ value: 62.41
34
+ name: BLEU Score
35
+ - type: chrf
36
+ value: 87.98
37
+ name: chrF Score
38
+ - type: accuracy
39
+ value: 58.81
40
+ name: Character Accuracy
41
+ ---
42
+
43
+ # MarianMT Eastern Syriac Vocalization Model
44
+
45
+ A fine-tuned MarianMT model for automatic Eastern Syriac (Mossul dialect) vocalization, converting consonantal (unvocalized) Syriac text to fully vocalized text with diacritical marks.
46
+
47
+ ## Model Description
48
+
49
+ This model is fine-tuned from [`Helsinki-NLP/opus-mt-tc-bible-big-sem-en`](https://huggingface.co/Helsinki-NLP/opus-mt-tc-bible-big-sem-en) to perform Eastern Syriac vocalization—the task of adding diacritical marks (vowels) to consonantal Syriac text. The model is specifically trained on **Eastern Syriac** texts, including the Mossul dialect, and is optimized for the Eastern Syriac vocalization system.
50
+
51
+ ### Key Features
52
+
53
+ - **Single-direction model**: Converts consonantal Syriac (`>>syr_cons<<`) to vocalized Eastern Syriac (`>>syr_voc<<`)
54
+ - **Eastern Syriac optimized**: Trained specifically on Eastern Syriac texts (Mossul dialect) and Digital Syriac Corpus texts vocalized in Eastern Syriac
55
+ - **High performance**: Achieves 62.41 BLEU, 87.98 chrF, and 58.81% character accuracy on test set
56
+ - **Biblical and corpus text optimized**: Trained on Eastern Syriac Bible texts (Mossul) and Digital Syriac Corpus texts
57
+
58
+ ## Model Details
59
+
60
+ ### Model Information
61
+
62
+ - **Architecture**: MarianMT (Transformer-based sequence-to-sequence)
63
+ - **Base Model**: `Helsinki-NLP/opus-mt-tc-bible-big-sem-en`
64
+ - **Parameters**: 240,944,128 (~241M)
65
+ - **Vocabulary Size**: 61,025 tokens
66
+ - **Language Tags**:
67
+ - Source: `>>syr_cons<<` (consonantal Syriac)
68
+ - Target: `>>syr_voc<<` (vocalized Eastern Syriac)
69
+
70
+ ### Training Data
71
+
72
+ - **Training Examples**: 26,633
73
+ - **Validation Examples**: 3,097
74
+ - **Test Examples**: 1,239
75
+ - **Total**: 30,969 sentence pairs
76
+ - **Source**:
77
+ - Eastern Syriac Bible texts (Mossul dialect)
78
+ - Digital Syriac Corpus texts vocalized in Eastern Syriac
79
+ - **Format**: Consonantal and vocalized Eastern Syriac pairs
80
+
81
+ ### Training Configuration
82
+
83
+ - **Batch Size**: 4
84
+ - **Effective Batch Size**: 16 (with gradient accumulation)
85
+ - **Learning Rate**: 1e-5
86
+ - **Max Input/Target Length**: 512 tokens
87
+ - **Training Steps**: 66,000 (early stopping)
88
+ - **Epochs**: 39.64
89
+ - **Optimizer**: AdamW with cosine learning rate schedule
90
+ - **Precision**: bfloat16
91
+ - **Early Stopping**: Based on validation metrics
92
+ - **Training Time**: ~2 days, 13 hours, 51 minutes
93
+
94
+ ### Performance
95
+
96
+ #### Best Validation Metrics (Epoch 36.04)
97
+ - **BLEU**: 63.04
98
+ - **chrF**: 88.19
99
+ - **Character Accuracy**: 57.84%
100
+ - **Validation Loss**: 0.0769
101
+
102
+ #### Final Test Metrics
103
+ - **BLEU**: **62.41**
104
+ - **chrF**: **87.98**
105
+ - **Character Accuracy**: **58.81%**
106
+ - **Test Loss**: 0.0782
107
+
108
+ ## Usage
109
+
110
+ ### Direct Usage
111
+
112
+ ```python
113
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
114
+
115
+ tokenizer = AutoTokenizer.from_pretrained("johnlockejrr/marianmt_syr_voc_eastern")
116
+ model = AutoModelForSeq2SeqLM.from_pretrained("johnlockejrr/marianmt_syr_voc_eastern")
117
+
118
+ # Input: consonantal Syriac text
119
+ text = "ܒܪܫܝܬ ܐܝܬܘܗܝ ܗܘܐ ܡܠܬܐ"
120
+
121
+ # Add language tag
122
+ input_text = f">>syr_cons<< {text}"
123
+
124
+ # Tokenize
125
+ inputs = tokenizer(input_text, return_tensors="pt", padding=True, truncation=True, max_length=512)
126
+
127
+ # Generate
128
+ outputs = model.generate(**inputs, max_length=512, num_beams=4, length_penalty=0.6)
129
+
130
+ # Decode
131
+ vocalized = tokenizer.decode(outputs[0], skip_special_tokens=True)
132
+ print(vocalized)
133
+ ```
134
+
135
+ ### Using the Pipeline
136
+
137
+ ```python
138
+ from transformers import pipeline
139
+
140
+ vocalizer = pipeline("text2text-generation",
141
+ model="johnlockejrr/marianmt_syr_voc_eastern",
142
+ tokenizer="johnlockejrr/marianmt_syr_voc_eastern")
143
+
144
+ # Input text (consonantal)
145
+ text = "ܒܪܫܝܬ ܐܝܬܘܗܝ ܗܘܐ ܡܠܬܐ"
146
+ input_text = f">>syr_cons<< {text}"
147
+
148
+ # Vocalize
149
+ result = vocalizer(input_text, max_length=512, num_beams=4, length_penalty=0.6)
150
+ print(result[0]['generated_text'])
151
+ ```
152
+
153
+ ### Text Normalization
154
+
155
+ The model expects input text to be normalized to NFC (Normalization Form Composed) Unicode format. The model automatically handles this, but for best results, ensure your input text is properly normalized:
156
+
157
+ ```python
158
+ import unicodedata
159
+
160
+ def normalize_text(text: str) -> str:
161
+ """Normalize text to NFC format."""
162
+ return unicodedata.normalize("NFC", text)
163
+
164
+ # Normalize input before processing
165
+ text = normalize_text("ܒܪܫܝܬ ܐܝܬܘܗܝ")
166
+ ```
167
+
168
+ ### Input Cleaning
169
+
170
+ For optimal results, input text should contain only consonantal Syriac characters. The model is designed to work with raw consonantal text, but it can handle text with some punctuation. For best performance, remove vocalization marks from input text if present.
171
+
172
+ ## Generation Parameters
173
+
174
+ Recommended generation parameters:
175
+
176
+ - **num_beams**: 4 (beam search for better quality)
177
+ - **length_penalty**: 0.6 (encourages longer outputs)
178
+ - **early_stopping**: True
179
+ - **max_length**: 512 (matches training configuration)
180
+ - **do_sample**: False (deterministic generation)
181
+
182
+ ## Limitations and Bias
183
+
184
+ - **Dialect Specificity**: This model is trained specifically on Eastern Syriac (Mossul dialect). Performance may vary on Western Syriac or other Syriac dialects.
185
+ - **Domain Specificity**: This model is trained primarily on biblical and corpus Syriac texts. Performance may vary on other domains (e.g., modern Syriac, poetry, prose).
186
+ - **Single Direction**: The model only vocalizes consonantal text. It does not perform the reverse operation (removing vocalization).
187
+ - **Length Constraints**: Maximum input/output length is 512 tokens. Longer texts should be split into smaller segments.
188
+ - **Character Accuracy**: While BLEU and chrF scores are high, character-level accuracy is ~59%, meaning some diacritical marks may be missing or incorrect in complex cases.
189
+
190
+ ## Training Procedure
191
+
192
+ ### Training Infrastructure
193
+
194
+ - **Hardware**: GPU (CUDA)
195
+ - **Training Time**: ~2 days, 13 hours, 51 minutes
196
+ - **Framework**: Hugging Face Transformers
197
+ - **Evaluation Frequency**: Every 1,000 steps
198
+
199
+ ### Preprocessing
200
+
201
+ - Text normalized to NFC Unicode format
202
+ - Language tags (`>>syr_cons<<` and `>>syr_voc<<`) added to tokenizer vocabulary
203
+ - Tokenization using SentencePiece (inherited from base model)
204
+
205
+ ### Hyperparameters
206
+
207
+ ```json
208
+ {
209
+ "learning_rate": 1e-5,
210
+ "batch_size": 4,
211
+ "gradient_accumulation_steps": 4,
212
+ "num_epochs": 100,
213
+ "max_input_length": 512,
214
+ "max_target_length": 512,
215
+ "warmup_steps": 1000,
216
+ "weight_decay": 0.01,
217
+ "eval_steps": 1000,
218
+ "save_steps": 1000,
219
+ "save_total_limit": 3
220
+ }
221
+ ```
222
+
223
+ ## Evaluation
224
+
225
+ The model is evaluated using three metrics:
226
+
227
+ 1. **BLEU Score**: Measures n-gram precision between generated and reference text
228
+ 2. **chrF Score**: Character-level F-score, more lenient than BLEU
229
+ 3. **Character Accuracy**: Exact character match percentage
230
+
231
+ ### Evaluation Results
232
+
233
+ | Metric | Validation (Best) | Test (Final) |
234
+ |--------|-------------------|-------------|
235
+ | BLEU | 63.04 | 62.41 |
236
+ | chrF | 88.19 | 87.98 |
237
+ | Char Acc | 57.84% | 58.81% |
238
+ | Loss | 0.0769 | 0.0782 |
239
+
240
+ ## Citation
241
+
242
+ If you use this model, please cite:
243
+
244
+ ```bibtex
245
+ @misc{marianmt_syr_voc_eastern,
246
+ title={MarianMT Eastern Syriac Vocalization Model},
247
+ author={johnlockejrr},
248
+ year={2025},
249
+ howpublished={\url{https://huggingface.co/johnlockejrr/marianmt_syr_voc_eastern}},
250
+ note={Fine-tuned from Helsinki-NLP/opus-mt-tc-bible-big-sem-en. Trained on Eastern Syriac Bible texts (Mossul) and Digital Syriac Corpus texts.}
251
+ }
252
+ ```
253
+
254
+ ## Acknowledgments
255
+
256
+ - **Base Model**: [Helsinki-NLP/opus-mt-tc-bible-big-sem-en](https://huggingface.co/Helsinki-NLP/opus-mt-tc-bible-big-sem-en) by the Helsinki NLP team
257
+ - **Framework**: [Hugging Face Transformers](https://github.com/huggingface/transformers)
258
+ - **Training Framework**: MarianMT architecture
259
+ - **Training Data**: Eastern Syriac Bible texts (Mossul dialect) and Digital Syriac Corpus texts
260
+
261
+ ## Model Card Contact
262
+
263
+ For questions, issues, or contributions, please open an issue on the model repository.
264
+
265
+ ## License
266
+
267
+ This model is released under the Apache 2.0 license, consistent with the base model.
268
+
added_tokens.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ ">>syr_cons<<": 61023,
3
+ ">>syr_voc<<": 61024
4
+ }
all_results.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 39.63973569605046,
3
+ "eval_bleu": 62.40825505874667,
4
+ "eval_char_accuracy": 58.8069928121235,
5
+ "eval_chrf": 87.98365764199096,
6
+ "eval_loss": 0.07816814631223679,
7
+ "eval_runtime": 1054.196,
8
+ "eval_samples_per_second": 1.175,
9
+ "eval_steps_per_second": 0.294,
10
+ "total_flos": 6.129316686672691e+16,
11
+ "train_loss": 0.06632431999797171,
12
+ "train_runtime": 222681.6466,
13
+ "train_samples_per_second": 11.96,
14
+ "train_steps_per_second": 0.748
15
+ }
config.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation_dropout": 0.0,
3
+ "activation_function": "relu",
4
+ "architectures": [
5
+ "MarianMTModel"
6
+ ],
7
+ "attention_dropout": 0.0,
8
+ "bos_token_id": 0,
9
+ "classifier_dropout": 0.0,
10
+ "d_model": 1024,
11
+ "decoder_attention_heads": 16,
12
+ "decoder_ffn_dim": 4096,
13
+ "decoder_layerdrop": 0.0,
14
+ "decoder_layers": 6,
15
+ "decoder_start_token_id": 61022,
16
+ "decoder_vocab_size": 61025,
17
+ "dropout": 0.1,
18
+ "encoder_attention_heads": 16,
19
+ "encoder_ffn_dim": 4096,
20
+ "encoder_layerdrop": 0.0,
21
+ "encoder_layers": 6,
22
+ "eos_token_id": 928,
23
+ "forced_eos_token_id": null,
24
+ "init_std": 0.02,
25
+ "is_encoder_decoder": true,
26
+ "max_length": null,
27
+ "max_position_embeddings": 1024,
28
+ "model_type": "marian",
29
+ "normalize_embedding": false,
30
+ "num_beams": null,
31
+ "num_hidden_layers": 6,
32
+ "pad_token_id": 61022,
33
+ "scale_embedding": true,
34
+ "share_encoder_decoder_embeddings": true,
35
+ "static_position_embeddings": true,
36
+ "torch_dtype": "float32",
37
+ "transformers_version": "4.52.4",
38
+ "use_cache": true,
39
+ "vocab_size": 61025
40
+ }
generation_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bad_words_ids": [
3
+ [
4
+ 61022
5
+ ]
6
+ ],
7
+ "bos_token_id": 0,
8
+ "decoder_start_token_id": 61022,
9
+ "eos_token_id": 928,
10
+ "forced_eos_token_id": 928,
11
+ "max_length": 512,
12
+ "num_beams": 4,
13
+ "pad_token_id": 61022,
14
+ "transformers_version": "4.52.4"
15
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d81fdd0b92fda214802a146298b7890f77deaad2d16570bf65635b392518e836
3
+ size 955661620
model_info.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_name": "Helsinki-NLP/opus-mt-tc-bible-big-sem-en",
3
+ "direction": "syr_cons→syr_voc (East Syriac)",
4
+ "vocabulary_size": 61025,
5
+ "model_parameters": 240944128,
6
+ "training_config": {
7
+ "dataset_path": "datasets/syriac_vocalization_dataset_east",
8
+ "output_dir": "./syr_voc_model_east",
9
+ "model_name": "Helsinki-NLP/opus-mt-tc-bible-big-sem-en",
10
+ "batch_size": 4,
11
+ "learning_rate": 1e-05,
12
+ "num_epochs": 100,
13
+ "max_input_length": 512,
14
+ "max_target_length": 512,
15
+ "eval_steps": 1000,
16
+ "save_steps": 1000,
17
+ "save_total_limit": 3,
18
+ "use_bf16": true,
19
+ "skip_evaluation": false,
20
+ "seed": 42,
21
+ "resume_from_checkpoint": null,
22
+ "weight_decay": 0.01,
23
+ "logging_steps": 100,
24
+ "warmup_steps": 1000,
25
+ "gradient_accumulation_steps": 4
26
+ }
27
+ }
source.spm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4027f4026e47c9ade0b5dde7d4ffc2f662b0ca832c062d43d7cef521fb6cea71
3
+ size 848358
special_tokens_map.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ {
4
+ "content": ">>syr_cons<<",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false
9
+ },
10
+ {
11
+ "content": ">>syr_voc<<",
12
+ "lstrip": false,
13
+ "normalized": false,
14
+ "rstrip": false,
15
+ "single_word": false
16
+ }
17
+ ],
18
+ "eos_token": "</s>",
19
+ "pad_token": "<pad>",
20
+ "unk_token": "<unk>"
21
+ }
target.spm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4fd6a59a41075b1f42d514de1da61a3b419c61f95342b5dd0dbff73f37317086
3
+ size 804382
test_results.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 39.63973569605046,
3
+ "eval_bleu": 62.40825505874667,
4
+ "eval_char_accuracy": 58.8069928121235,
5
+ "eval_chrf": 87.98365764199096,
6
+ "eval_loss": 0.07816814631223679,
7
+ "eval_runtime": 1054.196,
8
+ "eval_samples_per_second": 1.175,
9
+ "eval_steps_per_second": 0.294
10
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "928": {
4
+ "content": "</s>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1186": {
12
+ "content": "<unk>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "61022": {
20
+ "content": "<pad>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "61023": {
28
+ "content": ">>syr_cons<<",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "61024": {
36
+ "content": ">>syr_voc<<",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "additional_special_tokens": [
45
+ ">>syr_cons<<",
46
+ ">>syr_voc<<"
47
+ ],
48
+ "clean_up_tokenization_spaces": false,
49
+ "eos_token": "</s>",
50
+ "extra_special_tokens": {},
51
+ "model_max_length": 512,
52
+ "pad_token": "<pad>",
53
+ "separate_vocabs": false,
54
+ "source_lang": "sem",
55
+ "sp_model_kwargs": {},
56
+ "target_lang": "en",
57
+ "tokenizer_class": "MarianTokenizer",
58
+ "unk_token": "<unk>"
59
+ }
train_results.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 39.63973569605046,
3
+ "total_flos": 6.129316686672691e+16,
4
+ "train_loss": 0.06632431999797171,
5
+ "train_runtime": 222681.6466,
6
+ "train_samples_per_second": 11.96,
7
+ "train_steps_per_second": 0.748
8
+ }
trainer_state.json ADDED
The diff for this file is too large to render. See raw diff
 
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b01016a389e29fee8f2865cb4c0566bb9c1e50225de41c3564b94f0e8aadf521
3
+ size 5841
vocab.json ADDED
The diff for this file is too large to render. See raw diff