Fill-Mask
Transformers
Safetensors
Turkish
modernbert
turkish
encoder
foundation-model
aleynatasdemir commited on
Commit
1067913
·
verified ·
1 Parent(s): b20d57a

Add model weights, tokenizer and bilingual model card

Browse files
.gitattributes CHANGED
@@ -33,3 +33,8 @@ 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
+ assets/tabibench.png filter=lfs diff=lfs merge=lfs -text
37
+ assets/tabibench_en.png filter=lfs diff=lfs merge=lfs -text
38
+ assets/trglue.png filter=lfs diff=lfs merge=lfs -text
39
+ assets/trglue_en.png filter=lfs diff=lfs merge=lfs -text
40
+ banner.png filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - tr
5
+ library_name: transformers
6
+ pipeline_tag: fill-mask
7
+ tags:
8
+ - arxiv:2608.25768
9
+ - modernbert
10
+ - turkish
11
+ - encoder
12
+ - foundation-model
13
+ ---
14
+
15
+ <p align="center">
16
+ <img src="banner.png" alt="MoganBERT-TR" width="600"/>
17
+ </p>
18
+
19
+ <p align="center">
20
+ <a href="https://huggingface.co/papers/2608.25768"><img src="https://img.shields.io/badge/📄_Paper-arXiv-B31B1B?style=flat-square" alt="Paper"/></a>
21
+ <a href="https://moganai.github.io/"><img src="https://img.shields.io/badge/🌐_Blog-MoganAI-2E7D5B?style=flat-square" alt="Blog"/></a>
22
+ <a href="https://huggingface.co/collections/moganai/moganbert"><img src="https://img.shields.io/badge/🤗_Model_Collection-2C3E50?style=flat-square" alt="Model Collection"/></a>
23
+ </p>
24
+
25
+ # MoganBERT-TR
26
+
27
+ MoganBERT-TR is a 149.4M-parameter Turkish encoder with an 8,192-token context window, trained from scratch on 237.3B tokens. It follows the ModernBERT architecture — 22 layers, hidden size 768, 12 heads, alternating local/global attention — with a 50,048-token SentencePiece Unigram tokenizer trained for Turkish.
28
+
29
+ Unlike other Turkish encoders, it is pretrained with a two-stage **CLM→MLM curriculum** rather than pure MLM.
30
+
31
+ ## Usage
32
+
33
+ ```python
34
+ from transformers import pipeline
35
+
36
+ unmask = pipeline("fill-mask", model="moganai/MoganBERT-TR")
37
+ unmask("Türkiye'nin başkenti [MASK].")
38
+ ```
39
+
40
+ Use `classifier_pooling="mean"` (the config default) when fine-tuning — ModernBERT has no NSP, so `[CLS]` is not pretrained.
41
+
42
+ For embeddings and retrieval use [MoganBERT-embed](https://huggingface.co/moganai/MoganBERT-embed) or [MoganColBERT-TR](https://huggingface.co/moganai/MoganColBERT-TR); the raw encoder is anisotropic and unsuitable for direct cosine similarity.
43
+
44
+ ## Training
45
+
46
+ Pretrained on 4×H100 over 237.3B tokens: causal language modelling for the first 16.6% of the run, masked language modelling for the remainder, with the transition made inside the stable phase of a WSD schedule. Annealing extends the context 1024→8192, scales the global RoPE θ to 160k and lowers the mask rate to 10%. This checkpoint decays the final portion at 1024 context.
47
+
48
+ The corpus was built from FineWeb2, raw Common Crawl WARC records and printed/institutional sources, filtered with a fastText quality classifier distilled from a fine-tuned Turkish BERT. The mixture is ~73% Turkish, ~17% English and ~10% code.
49
+
50
+ ## Results
51
+
52
+ Evaluated on TrGLUE (8 tasks, 5 official seeds, official `run_trglue.py`) and TabiBench (28 datasets, 8 categories).
53
+
54
+ <img src="assets/trglue_en.png" alt="TrGLUE" width="850"/>
55
+
56
+ <img src="assets/tabibench_en.png" alt="TabiBench" width="850"/>
57
+
58
+ TabiBench is single-seed; sub-one-point margins are not an ordering. Full per-task numbers are in the [paper](https://huggingface.co/papers/2608.25768).
59
+
60
+ ## Model Family
61
+
62
+ | Model | Params | Purpose |
63
+ |---|---:|---|
64
+ | [**MoganBERT-TR**](https://huggingface.co/moganai/MoganBERT-TR) | 149.4M | Base encoder (this model) |
65
+ | [MoganBERT-embed](https://huggingface.co/moganai/MoganBERT-embed) | 149M | Single-vector embeddings |
66
+ | [MoganColBERT-TR](https://huggingface.co/moganai/MoganColBERT-TR) | 148.9M | Multi-vector retrieval |
67
+
68
+ ## Citation
69
+
70
+ ```bibtex
71
+ @article{yilmaz2026moganbert,
72
+ title = {MoganBert-TR: A Turkish Encoder Foundation Model Trained from Scratch with a CLM-MLM Curriculum},
73
+ author = {Furkan Yilmaz and Habibe Aleyna Tasdemir and Muhammed Faruk Gozay},
74
+ journal = {arXiv preprint arXiv:2608.25768},
75
+ year = {2026}
76
+ }
77
+ ```
78
+
79
+ ---
80
+ ---
81
+
82
+ <p align="center">
83
+ <img src="banner.png" alt="MoganBERT-TR" width="600"/>
84
+ </p>
85
+
86
+ # MoganBERT-TR (Türkçe)
87
+
88
+ MoganBERT-TR, 8.192 token bağlam penceresine sahip, 237.3 milyar token üzerinde sıfırdan eğitilmiş 149.4M parametreli bir Türkçe encoder'dır. ModernBERT mimarisini izler — 22 katman, gizli boyut 768, 12 başlık, dönüşümlü yerel/küresel dikkat — ve Türkçe için eğitilmiş 50.048 tokenlık bir SentencePiece Unigram tokenizer kullanır.
89
+
90
+ Diğer Türkçe encoder'lardan farklı olarak saf MLM yerine iki aşamalı bir **CLM→MLM müfredatı** ile ön-eğitilmiştir.
91
+
92
+ ## Kullanım
93
+
94
+ ```python
95
+ from transformers import pipeline
96
+
97
+ unmask = pipeline("fill-mask", model="moganai/MoganBERT-TR")
98
+ unmask("Türkiye'nin başkenti [MASK].")
99
+ ```
100
+
101
+ İnce ayarda `classifier_pooling="mean"` (config varsayılanı) kullanın — ModernBERT'te NSP olmadığı için `[CLS]` ön-eğitilmiş değildir.
102
+
103
+ Gömme ve arama için [MoganBERT-embed](https://huggingface.co/moganai/MoganBERT-embed) veya [MoganColBERT-TR](https://huggingface.co/moganai/MoganColBERT-TR) kullanın; ham encoder anizotropiktir ve doğrudan kosinüs benzerliğine uygun değildir.
104
+
105
+ ## Eğitim
106
+
107
+ 4×H100 üzerinde 237.3 milyar token ile ön-eğitildi: eğitimin ilk %16.6'sı nedensel dil modellemesi, kalanı maskeli dil modellemesi; geçiş WSD çizelgesinin durağan fazı içinde yapıldı. Tavlama bağlamı 1024→8192'ye çıkarır, küresel RoPE θ'yı 160k'ya ölçekler ve maske oranını %10'a indirir. Bu checkpoint son bölümü 1024 bağlamda sönümler.
108
+
109
+ Külliyat FineWeb2, ham Common Crawl WARC kayıtları ve basılı/kurumsal kaynaklardan derlendi; ince ayarlanmış bir Türkçe BERT'ten damıtılan fastText kalite sınıflandırıcısıyla filtrelendi. Karışım ~%73 Türkçe, ~%17 İngilizce ve ~%10 kod.
110
+
111
+ ## Sonuçlar
112
+
113
+ TrGLUE (8 görev, 5 resmî tohum, resmî `run_trglue.py`) ve TabiBench (28 veri kümesi, 8 kategori) üzerinde ölçüldü.
114
+
115
+ <img src="assets/trglue.png" alt="TrGLUE" width="850"/>
116
+
117
+ <img src="assets/tabibench.png" alt="TabiBench" width="850"/>
118
+
119
+ TabiBench tek tohumludur; bir puanın altındaki farklar bir sıralama değildir. Görev bazlı tüm sayılar [makalede](https://huggingface.co/papers/2608.25768).
120
+
121
+ ## Model Ailesi
122
+
123
+ | Model | Parametre | Amaç |
124
+ |---|---:|---|
125
+ | [**MoganBERT-TR**](https://huggingface.co/moganai/MoganBERT-TR) | 149.4M | Temel encoder (bu model) |
126
+ | [MoganBERT-embed](https://huggingface.co/moganai/MoganBERT-embed) | 149M | Tek vektörlü gömme |
127
+ | [MoganColBERT-TR](https://huggingface.co/moganai/MoganColBERT-TR) | 148.9M | Çok vektörlü retrieval |
128
+
129
+ ## Atıf
130
+
131
+ ```bibtex
132
+ @article{yilmaz2026moganbert,
133
+ title = {MoganBert-TR: A Turkish Encoder Foundation Model Trained from Scratch with a CLM-MLM Curriculum},
134
+ author = {Furkan Yilmaz and Habibe Aleyna Tasdemir and Muhammed Faruk Gozay},
135
+ journal = {arXiv preprint arXiv:2608.25768},
136
+ year = {2026}
137
+ }
138
+ ```
assets/tabibench.png ADDED

Git LFS Details

  • SHA256: 9306a7f49c082cfef3c9c8edd4d8a6f7440d95cb8303214757fcbc711bda8f59
  • Pointer size: 131 Bytes
  • Size of remote file: 189 kB
assets/tabibench_en.png ADDED

Git LFS Details

  • SHA256: d1c192d20f55f5d7c2ea606f93e4b8f2ce7373f8c8eb0a781f65751bcd7d0dce
  • Pointer size: 131 Bytes
  • Size of remote file: 196 kB
assets/trglue.png ADDED

Git LFS Details

  • SHA256: 16e2c94026462e9468ee5bde6b0057940a6143f47f5d16c08552e7aa6f1eefea
  • Pointer size: 131 Bytes
  • Size of remote file: 209 kB
assets/trglue_en.png ADDED

Git LFS Details

  • SHA256: 88b8a2f317fe4aea074d82bb4ff2fac90addccccd4d425c5da49ea26cff13b6c
  • Pointer size: 131 Bytes
  • Size of remote file: 206 kB
banner.png ADDED

Git LFS Details

  • SHA256: c9a275d1c5baae9aa9960a18e6039bbcc273ec4c2b8d7b0c85f42c93ccb6d7c1
  • Pointer size: 131 Bytes
  • Size of remote file: 741 kB
config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "ModernBertForMaskedLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 2,
8
+ "classifier_activation": "gelu",
9
+ "classifier_bias": false,
10
+ "classifier_dropout": 0.0,
11
+ "classifier_pooling": "mean",
12
+ "cls_token_id": 2,
13
+ "decoder_bias": true,
14
+ "deterministic_flash_attn": false,
15
+ "dtype": "float32",
16
+ "embedding_dropout": 0.0,
17
+ "eos_token_id": 3,
18
+ "global_attn_every_n_layers": 3,
19
+ "global_rope_theta": 160000.0,
20
+ "hidden_activation": "gelu",
21
+ "hidden_size": 768,
22
+ "initializer_cutoff_factor": 2.0,
23
+ "initializer_range": 0.02,
24
+ "intermediate_size": 1152,
25
+ "local_attention": 128,
26
+ "local_rope_theta": 10000.0,
27
+ "max_position_embeddings": 8192,
28
+ "mlp_bias": false,
29
+ "mlp_dropout": 0.0,
30
+ "model_type": "modernbert",
31
+ "norm_bias": false,
32
+ "norm_eps": 1e-05,
33
+ "num_attention_heads": 12,
34
+ "num_hidden_layers": 22,
35
+ "pad_token_id": 1,
36
+ "repad_logits_with_grad": false,
37
+ "sep_token_id": 3,
38
+ "sparse_pred_ignore_index": -100,
39
+ "sparse_prediction": true,
40
+ "transformers_version": "4.57.6",
41
+ "vocab_size": 50048
42
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:083817ab314e14625eda60d187f5a4b77fd547ccf7520e464c8f62db4717cf26
3
+ size 597650712
special_tokens_map.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "[unused0]",
4
+ "[unused1]",
5
+ "[unused2]",
6
+ "[unused3]",
7
+ "[unused4]",
8
+ "[unused5]",
9
+ "[unused6]",
10
+ "[unused7]",
11
+ "[unused8]",
12
+ "[unused9]",
13
+ "[unused10]",
14
+ "[unused11]",
15
+ "[unused12]",
16
+ "[unused13]",
17
+ "[unused14]",
18
+ "[unused15]"
19
+ ],
20
+ "cls_token": "[CLS]",
21
+ "eos_token": "[EOS]",
22
+ "mask_token": {
23
+ "content": "[MASK]",
24
+ "lstrip": true,
25
+ "normalized": false,
26
+ "rstrip": false,
27
+ "single_word": false
28
+ },
29
+ "pad_token": "[PAD]",
30
+ "sep_token": "[SEP]",
31
+ "unk_token": "[UNK]"
32
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[UNK]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "[PAD]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "4": {
36
+ "content": "[MASK]",
37
+ "lstrip": true,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "5": {
44
+ "content": "[EOS]",
45
+ "lstrip": false,
46
+ "normalized": false,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": true
50
+ },
51
+ "6": {
52
+ "content": "[unused0]",
53
+ "lstrip": false,
54
+ "normalized": false,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": true
58
+ },
59
+ "7": {
60
+ "content": "[unused1]",
61
+ "lstrip": false,
62
+ "normalized": false,
63
+ "rstrip": false,
64
+ "single_word": false,
65
+ "special": true
66
+ },
67
+ "8": {
68
+ "content": "[unused2]",
69
+ "lstrip": false,
70
+ "normalized": false,
71
+ "rstrip": false,
72
+ "single_word": false,
73
+ "special": true
74
+ },
75
+ "9": {
76
+ "content": "[unused3]",
77
+ "lstrip": false,
78
+ "normalized": false,
79
+ "rstrip": false,
80
+ "single_word": false,
81
+ "special": true
82
+ },
83
+ "10": {
84
+ "content": "[unused4]",
85
+ "lstrip": false,
86
+ "normalized": false,
87
+ "rstrip": false,
88
+ "single_word": false,
89
+ "special": true
90
+ },
91
+ "11": {
92
+ "content": "[unused5]",
93
+ "lstrip": false,
94
+ "normalized": false,
95
+ "rstrip": false,
96
+ "single_word": false,
97
+ "special": true
98
+ },
99
+ "12": {
100
+ "content": "[unused6]",
101
+ "lstrip": false,
102
+ "normalized": false,
103
+ "rstrip": false,
104
+ "single_word": false,
105
+ "special": true
106
+ },
107
+ "13": {
108
+ "content": "[unused7]",
109
+ "lstrip": false,
110
+ "normalized": false,
111
+ "rstrip": false,
112
+ "single_word": false,
113
+ "special": true
114
+ },
115
+ "14": {
116
+ "content": "[unused8]",
117
+ "lstrip": false,
118
+ "normalized": false,
119
+ "rstrip": false,
120
+ "single_word": false,
121
+ "special": true
122
+ },
123
+ "15": {
124
+ "content": "[unused9]",
125
+ "lstrip": false,
126
+ "normalized": false,
127
+ "rstrip": false,
128
+ "single_word": false,
129
+ "special": true
130
+ },
131
+ "16": {
132
+ "content": "[unused10]",
133
+ "lstrip": false,
134
+ "normalized": false,
135
+ "rstrip": false,
136
+ "single_word": false,
137
+ "special": true
138
+ },
139
+ "17": {
140
+ "content": "[unused11]",
141
+ "lstrip": false,
142
+ "normalized": false,
143
+ "rstrip": false,
144
+ "single_word": false,
145
+ "special": true
146
+ },
147
+ "18": {
148
+ "content": "[unused12]",
149
+ "lstrip": false,
150
+ "normalized": false,
151
+ "rstrip": false,
152
+ "single_word": false,
153
+ "special": true
154
+ },
155
+ "19": {
156
+ "content": "[unused13]",
157
+ "lstrip": false,
158
+ "normalized": false,
159
+ "rstrip": false,
160
+ "single_word": false,
161
+ "special": true
162
+ },
163
+ "20": {
164
+ "content": "[unused14]",
165
+ "lstrip": false,
166
+ "normalized": false,
167
+ "rstrip": false,
168
+ "single_word": false,
169
+ "special": true
170
+ },
171
+ "21": {
172
+ "content": "[unused15]",
173
+ "lstrip": false,
174
+ "normalized": false,
175
+ "rstrip": false,
176
+ "single_word": false,
177
+ "special": true
178
+ }
179
+ },
180
+ "additional_special_tokens": [
181
+ "[unused0]",
182
+ "[unused1]",
183
+ "[unused2]",
184
+ "[unused3]",
185
+ "[unused4]",
186
+ "[unused5]",
187
+ "[unused6]",
188
+ "[unused7]",
189
+ "[unused8]",
190
+ "[unused9]",
191
+ "[unused10]",
192
+ "[unused11]",
193
+ "[unused12]",
194
+ "[unused13]",
195
+ "[unused14]",
196
+ "[unused15]"
197
+ ],
198
+ "clean_up_tokenization_spaces": false,
199
+ "cls_token": "[CLS]",
200
+ "eos_token": "[EOS]",
201
+ "extra_special_tokens": {},
202
+ "mask_token": "[MASK]",
203
+ "model_max_length": 8192,
204
+ "pad_token": "[PAD]",
205
+ "sep_token": "[SEP]",
206
+ "tokenizer_class": "PreTrainedTokenizerFast",
207
+ "unk_token": "[UNK]"
208
+ }