cmagui commited on
Commit
6e02c4c
·
verified ·
1 Parent(s): ce068c3

Initial release: weights, model card, and phoneme token maps

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. README.md +128 -3
  3. model.t7 +3 -0
  4. phoneme_token_maps.json +352 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ 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
+ model.t7 filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,3 +1,128 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - gl
4
+ license: apache-2.0
5
+ tags:
6
+ - phoneme-level
7
+ - modernbert
8
+ - galician
9
+ - text-to-speech
10
+ - tts
11
+ - masked-lm
12
+ - proxecto-nos
13
+ metrics:
14
+ - precision
15
+ ---
16
+
17
+ # PL-ModernBERT-gl: Phoneme-level ModernBERT for Galician
18
+
19
+ ## Overview
20
+ - [Model Description](#model-description)
21
+ - [Intended Uses and Limitations](#intended-uses-and-limitations)
22
+ - [Training Details](#training-details)
23
+ - [Evaluation](#evaluation)
24
+ - [Citation](#citation)
25
+ - [Additional Information](#additional-information)
26
+
27
+ ---
28
+
29
+ ## Model Description
30
+
31
+ **PL-ModernBERT-gl** is a phoneme-level masked language model trained on Galician text. It is based on the state-of-the-art **ModernBERT** architecture, adapting the Phoneme-Level BERT (PL-BERT) framework to learn contextualized phoneme representations via masked language modeling and alignment objectives.
32
+
33
+ This model is designed to support phoneme-based text-to-speech (TTS) systems, including but not limited to *StyleTTS2*. Thanks to its Galician-specific phoneme vocabulary and contextual embedding capabilities, it can serve as a high-precision phoneme encoder for any TTS architecture requiring phoneme-level features.
34
+
35
+ ### Key Improvements & Features:
36
+ * **Native Galician Pipeline:** Unlike the original PL-BERT architecture which relied on English phonemizers, this model integrates the open-source linguistic tool **Cotovía** for native Galician grapheme-to-phoneme transcription and text normalization.
37
+ * **1:1 Alignment System:** Implements a strict sequential alignment between graphemes and phonemes, successfully handling Galician digraphs (e.g., `ll`, `rr`, `ch`, `nh`, `qu`), silent characters (e.g., silent `h`), and morphosyntactic contractions (e.g., `para` + `a` $\rightarrow$ `pra`).
38
+ * **Dual-Head Architecture:** The core encoder branches into two parallel prediction layers during training:
39
+ * **MLM Head (Masked Language Modeling):** Predicts the identity of masked phonemes.
40
+ * **P2G Head (Phoneme-to-Grapheme):** Predicts the corresponding grapheme for aligned feature extraction.
41
+
42
+ ---
43
+
44
+ ## Intended Uses and Limitations
45
+
46
+ ### Intended uses
47
+ * Integration into phoneme-based Galician TTS pipelines (such as *StyleTTS2*).
48
+ * Contextualized phoneme embedding extraction for downstream speech and linguistic tasks in the Galician language.
49
+
50
+ ### Limitations
51
+ * Not designed for general-purpose word-level NLP tasks (e.g., standard text classification, Named Entity Recognition, or sentiment analysis).
52
+ * Strictly supports Galician phoneme tokens mapped through the provided tokenizer utilities.
53
+
54
+ ---
55
+
56
+ ## Training Details
57
+
58
+ ### Training Data
59
+ The model was pre-trained on a curated Galician corpus of **11.6 million words** compiled from diverse domains under open licenses:
60
+
61
+ | Corpus Source | Domain | Word Count | License |
62
+ | :--- | :--- | :---: | :--- |
63
+ | *Enciclopedia Galega Universal* | Encyclopedic | 4,751,813 | CC-BY-4.0 |
64
+ | *URCO Editora* | Literature / Novels | 1,937,517 | CC-BY-4.0 |
65
+ | *Wikipedia* | Encyclopedic | 1,794,937 | CC-BY-SA-4.0 |
66
+ | *Mallando no Android* | Technology Blog | 1,553,327 | CC-BY-4.0 |
67
+ | *Revista Pincha* | Culture Blog | 669,020 | CC-BY-4.0 |
68
+ | *A Nosa Terra* | Journalistic | 652,372 | CC-BY-4.0 |
69
+ | *Servizo Publicacións USC* | Academic / Scientific | 280,858 | CC-BY-4.0 |
70
+ | **Total** | | **11,639,844** | |
71
+
72
+ #### Prosodic Enrichment
73
+ To capture expressive prosody and speech modulation, the training corpus was enriched with two dedicated subsets of **66,338 interrogative sentences** and **11,546 exclamative sentences**.
74
+
75
+ ### Dynamic Masking Strategy
76
+ To force the model to prioritize prosodic clues over highly frequent phonemes, an inverse-frequency dynamic masking algorithm was implemented:
77
+ * **Common Phonemes:** 15% masking probability.
78
+ * **Standard Punctuation Marks:** 40% masking probability.
79
+ * **Critical Prosodic Marks (`!`, `?`):** 80% masking probability.
80
+
81
+ ### Training Configuration
82
+
83
+ | Parameter | Value |
84
+ | :--- | :--- |
85
+ | **Model Type / Core Architecture** | ModernBERT (12 layers, 12 attention heads) |
86
+ | **Hidden Size** | 768 |
87
+ | **Intermediate Size (FFN)** | 2048 |
88
+ | **Batch Size** | 64 |
89
+ | **Total Steps** | 200,000 |
90
+ | **Precision** | Mixed Precision (`fp16`) |
91
+ | **Initial Learning Rate** | 1e-4 |
92
+ | **Scheduler Type** | `onecycle` (Cos annealing strategy, Warmup ratio: 0.1) |
93
+ | **Max Sequence Length** | 512 |
94
+ | **Replacement Probability** | 0.2 |
95
+
96
+ ## Evaluation
97
+ The model was evaluated using an independent test partition from the core phonemized Galician dataset. Performance was tracked via Masked Language Modeling accuracy (predicting masked phonemes) and Phoneme-to-Grapheme symbolic alignment metrics (predicting corresponding characters):
98
+
99
+ | Metric | Value |
100
+ |-------------------|------|
101
+ | **Precisión MLM** | 89.54% |
102
+ | **Precisión P2G** | 97.88% |
103
+
104
+ ## Citation
105
+ If this model or code contributes to your research, please cite it as follows:
106
+
107
+ @misc{proxectonos/PL-ModernBERT-gl,
108
+ author = {{Proxecto Nós}},
109
+ title = {{PL-ModernBERT-gl: Phoneme-level ModernBERT for Galician}},
110
+ year = {2026},
111
+ publisher = {Hugging Face},
112
+ howpublished = {\url{[https://huggingface.co/proxectonos/PL-ModernBERT-gl](https://huggingface.co/proxectonos/PL-ModernBERT-gl)}},
113
+ }
114
+
115
+ ## Additional Information
116
+
117
+ ### Licensing
118
+ This model is licensed under the **Apache License 2.0**.
119
+
120
+ #### Authors and Credits
121
+ * **Project Oversight:** Proxecto Nós
122
+ * **Technical Development:** [Gradiant](https://www.gradiant.org/) (Centro Tecnolóxico de Telecomunicacións de Galicia)
123
+
124
+ ### Funding
125
+ This work is funded by the Ministerio para la Transformación Digital y de la Función Pública - Funded by EU – NextGenerationEU within the framework of the project Desarrollo de Modelos ALIA.
126
+
127
+ ## Acknowledgements
128
+ We would like to express our gratitude to the engineering and research teams at **Gradiant** for the technical development of this model.
model.t7 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f59dfc1bebefbbbe6b8b3ec43659d9db59be915efa9a5a6e4638b8ced879c5b0
3
+ size 1021339920
phoneme_token_maps.json ADDED
@@ -0,0 +1,352 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "0": {
3
+ "phoneme": "X",
4
+ "token": 0,
5
+ "grapheme" : " "
6
+ },
7
+ "1": {
8
+ "phoneme": " ",
9
+ "token": 1,
10
+ "grapheme" : " "
11
+ },
12
+ "2": {
13
+ "phoneme": "$",
14
+ "token": 2,
15
+ "grapheme" : " "
16
+ },
17
+ "3": {
18
+ "phoneme": "M",
19
+ "token": 3,
20
+ "grapheme" : " "
21
+ },
22
+ "4": {
23
+ "phoneme": ",",
24
+ "token": 4,
25
+ "grapheme" :","
26
+ },
27
+ "5": {
28
+ "phoneme": ".",
29
+ "token": 5,
30
+ "grapheme" :"."
31
+ },
32
+ "6": {
33
+ "phoneme": "a",
34
+ "token": 6,
35
+ "grapheme" :"a"
36
+ },
37
+ "7": {
38
+ "phoneme": "E",
39
+ "token": 7,
40
+ "grapheme" : "e"
41
+ },
42
+ "8": {
43
+ "phoneme": "e",
44
+ "token": 8,
45
+ "grapheme" : "e"
46
+ },
47
+ "9": {
48
+ "phoneme": "i",
49
+ "token": 9,
50
+ "grapheme" : "i"
51
+ },
52
+ "10": {
53
+ "phoneme": "j",
54
+ "token": 10,
55
+ "grapheme" : "i"
56
+ },
57
+ "11": {
58
+ "phoneme": "O",
59
+ "token": 11,
60
+ "grapheme" : "o"
61
+ },
62
+ "12": {
63
+ "phoneme": "o",
64
+ "token": 12,
65
+ "grapheme" : "o"
66
+ },
67
+ "13": {
68
+ "phoneme": "u",
69
+ "token": 13,
70
+ "grapheme" : "u"
71
+ },
72
+ "14": {
73
+ "phoneme": "w",
74
+ "token": 14,
75
+ "grapheme" : "u"
76
+ },
77
+ "15": {
78
+ "phoneme": "p",
79
+ "token": 15,
80
+ "grapheme" : "p"
81
+ },
82
+ "16": {
83
+ "phoneme": "b",
84
+ "token": 16,
85
+ "grapheme" : "b"
86
+ },
87
+ "17": {
88
+ "phoneme": "B",
89
+ "token": 17,
90
+ "grapheme" : "b"
91
+ },
92
+ "18": {
93
+ "phoneme": "t",
94
+ "token": 18,
95
+ "grapheme" : "t"
96
+ },
97
+ "19": {
98
+ "phoneme": "d",
99
+ "token": 19,
100
+ "grapheme" : "d"
101
+ },
102
+ "20": {
103
+ "phoneme": "D",
104
+ "token": 20,
105
+ "grapheme" : "d"
106
+ },
107
+ "21": {
108
+ "phoneme": "k",
109
+ "token": 21,
110
+ "grapheme" : "c"
111
+ },
112
+ "22": {
113
+ "phoneme": "g",
114
+ "token": 22,
115
+ "grapheme" : "g"
116
+ },
117
+ "23": {
118
+ "phoneme": "G",
119
+ "token": 23,
120
+ "grapheme" : "g"
121
+ },
122
+ "24": {
123
+ "phoneme": "f",
124
+ "token": 24,
125
+ "grapheme" : "f"
126
+ },
127
+ "25": {
128
+ "phoneme": "T",
129
+ "token": 25,
130
+ "grapheme" : "z"
131
+ },
132
+ "26": {
133
+ "phoneme": "s",
134
+ "token": 26,
135
+ "grapheme" : "s"
136
+ },
137
+ "27": {
138
+ "phoneme": "S",
139
+ "token": 27,
140
+ "grapheme" : "x"
141
+ },
142
+ "28": {
143
+ "phoneme": "m",
144
+ "token": 28,
145
+ "grapheme" : "m"
146
+ },
147
+ "29": {
148
+ "phoneme": "n",
149
+ "token": 29,
150
+ "grapheme" : "n"
151
+ },
152
+ "30": {
153
+ "phoneme": "J",
154
+ "token": 30,
155
+ "grapheme" : "ñ"
156
+ },
157
+ "31": {
158
+ "phoneme": "N",
159
+ "token": 31,
160
+ "grapheme" : "nh"
161
+ },
162
+ "32": {
163
+ "phoneme": "l",
164
+ "token": 32,
165
+ "grapheme" : "l"
166
+ },
167
+ "33": {
168
+ "phoneme": "Z",
169
+ "token": 33,
170
+ "grapheme" : "ll"
171
+ },
172
+ "34": {
173
+ "phoneme": "r",
174
+ "token": 34,
175
+ "grapheme" : "r"
176
+ },
177
+ "35": {
178
+ "phoneme": "R",
179
+ "token": 35,
180
+ "grapheme" : "rr"
181
+ },
182
+ "36": {
183
+ "phoneme": "x",
184
+ "token": 36,
185
+ "grapheme" : "j"
186
+ },
187
+ "37": {
188
+ "phoneme": "C",
189
+ "token": 37,
190
+ "grapheme" : "ch"
191
+ },
192
+ "38": {
193
+ "phoneme": "!",
194
+ "token": 38,
195
+ "grapheme" : "!"
196
+ },
197
+ "39": {
198
+ "phoneme": "\"",
199
+ "token": 39,
200
+ "grapheme" : "\""
201
+ },
202
+ "40": {
203
+ "phoneme": "(",
204
+ "token": 40,
205
+ "grapheme" : "("
206
+ },
207
+ "41": {
208
+ "phoneme": ")",
209
+ "token": 41,
210
+ "grapheme" : ")"
211
+ },
212
+ "42": {
213
+ "phoneme": "/",
214
+ "token": 42,
215
+ "grapheme" : "/"
216
+ },
217
+ "43": {
218
+ "phoneme": ":",
219
+ "token": 43,
220
+ "grapheme" : ":"
221
+ },
222
+ "44": {
223
+ "phoneme": ";",
224
+ "token": 44,
225
+ "grapheme" : ";"
226
+ },
227
+ "45": {
228
+ "phoneme": "?",
229
+ "token": 45,
230
+ "grapheme" : "?"
231
+ },
232
+ "46": {
233
+ "phoneme": "[",
234
+ "token": 46,
235
+ "grapheme" : "["
236
+ },
237
+ "47": {
238
+ "phoneme": "]",
239
+ "token": 47,
240
+ "grapheme" : "]"
241
+ },
242
+ "48": {
243
+ "phoneme": "{",
244
+ "token": 48,
245
+ "grapheme" : "{"
246
+ },
247
+ "49": {
248
+ "phoneme": "}",
249
+ "token": 49,
250
+ "grapheme" : "}"
251
+ },
252
+ "50": {
253
+ "phoneme": "¡",
254
+ "token": 50,
255
+ "grapheme" : "¡"
256
+ },
257
+ "51": {
258
+ "phoneme": "º",
259
+ "token": 51,
260
+ "grapheme" : "º"
261
+ },
262
+ "52": {
263
+ "phoneme": "ª",
264
+ "token": 52,
265
+ "grapheme" : "ª"
266
+ },
267
+ "53": {
268
+ "phoneme": "`",
269
+ "token": 53,
270
+ "grapheme" : "`"
271
+ },
272
+ "54": {
273
+ "phoneme": "¿",
274
+ "token": 54,
275
+ "grapheme" : "¿"
276
+ },
277
+ "55": {
278
+ "phoneme": "K",
279
+ "token": 55,
280
+ "grapheme" : "x"
281
+ },
282
+ "56": {
283
+ "phoneme": "W",
284
+ "token": 56,
285
+ "grapheme" : "x"
286
+ },
287
+ "57": {
288
+ "phoneme": "O",
289
+ "token": 57,
290
+ "grapheme" : "ao"
291
+ },
292
+ "58": {
293
+ "phoneme": "W",
294
+ "token": 58,
295
+ "grapheme" : "tS"
296
+ },
297
+ "59": {
298
+ "phoneme": "á",
299
+ "token": 59,
300
+ "grapheme" : "á"
301
+ },
302
+ "60": {
303
+ "phoneme": "É",
304
+ "token": 60,
305
+ "grapheme" : "é"
306
+ },
307
+ "61": {
308
+ "phoneme": "é",
309
+ "token": 61,
310
+ "grapheme" : "é"
311
+ },
312
+ "62": {
313
+ "phoneme": "í",
314
+ "token": 62,
315
+ "grapheme" : "í"
316
+ },
317
+ "63": {
318
+ "phoneme": "j́",
319
+ "token": 63,
320
+ "grapheme" : "í"
321
+ },
322
+ "64": {
323
+ "phoneme": "Ó",
324
+ "token": 64,
325
+ "grapheme" : "ó"
326
+ },
327
+ "65": {
328
+ "phoneme": "ó",
329
+ "token": 65,
330
+ "grapheme" : "ó"
331
+ },
332
+ "66": {
333
+ "phoneme": "ú",
334
+ "token": 66,
335
+ "grapheme" : "ú"
336
+ },
337
+ "67": {
338
+ "phoneme": "ẃ",
339
+ "token": 67,
340
+ "grapheme" : "ú"
341
+ },
342
+ "68": {
343
+ "phoneme": "s",
344
+ "token": 68,
345
+ "grapheme" : "ps"
346
+ },
347
+ "69": {
348
+ "phoneme": "n",
349
+ "token": 69,
350
+ "grapheme" : "pn"
351
+ }
352
+ }