FremyCompany commited on
Commit
307b936
·
verified ·
1 Parent(s): 9590278

Initial upload

Browse files
README.md CHANGED
@@ -1,3 +1,300 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - nl
4
+ license: apache-2.0
5
+ tags:
6
+ - sentence-transformers
7
+ - sentence-similarity
8
+ - feature-extraction
9
+ - generated_from_trainer
10
+ - dataset_size:8066634
11
+ - loss:MultipleNegativesRankingLoss
12
+ widget:
13
+ - source_sentence: Er kwamen drie mysterieuze mannen ter hulp.
14
+ sentences:
15
+ - Drie vreemde lui hielpte ons dan.
16
+ - Er kwamen drie zwarte vogels in onze tuin.
17
+ - Er zijn mensen die hulpzaam zijn.
18
+ - Een, twee, drie... Wie kan de volgende cijfers aanraden?
19
+ pipeline_tag: sentence-similarity
20
+ library_name: sentence-transformers
21
+ ---
22
+
23
+ # FMMB-BE-NL: The Fairly Multilingual ModernBERT Embedding Model (Belgian Edition): Monolingual Dutch version.
24
+
25
+ 🇳🇱 This monolingual Dutch version of the [Fairly Multilingual ModernBERT Embedding Model (Belgian Edition)](https://huggingface.co/Parallia/Fairly-Multilingual-ModernBERT-Embed-BE) is the perfect model for embedding texts up to 8192 tokens written in Dutch at the speed of light. It uses the exact same weights as the original FMMB-BE model, and therefore produces identical embeddings, but this version comes with only a Dutch-optimized tokenizer and its associated embedding table, thereby improving performance.
26
+
27
+ 🆘 This [sentence-transformers](https://www.SBERT.net) model was trained on a small parallel corpus containing English-French, English-Dutch, and English-German sentence pairs. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more. The input texts can be used as-is, no need to use prefixes.
28
+
29
+ 🪄 Thanks to the magic of [Trans-Tokenization](https://huggingface.co/papers/2408.04303), monoligual English models such as [ModernBERT-Embed from Nomic AI](https://huggingface.co/nomic-ai/modernbert-embed-base) can be turned into embedding models for another language. And this, with almost no GPU compute involved! 🤯
30
+
31
+ ⚖️ Each of the 5 FMMB-BE models are actually copies of the exact same model, paired with different tokenizers and embedding tables. Indeed, as all trans-tokenized models operate on embeddings in the same latent space, aligning them cross-lingually is a breeze: after creating a "super" model which can speak in all of the 4 tokenizers, this model can be finetuned to produce similar embeddings for sentences which are translation of each other.
32
+
33
+ ⚡ ModernBERT, developped last month by Answer Ai and LightOn, is about 3x to 6x faster at inference time than regular BERT/RoBERTa models, while providing us with superior results. This makes it a wonderful choice for many use cases.
34
+
35
+
36
+ ## Model Details
37
+
38
+ ### Model Description
39
+ - **Model Type:** Sentence Transformer
40
+ - **Base model:** [ModernBERT-Embed-Base](https://huggingface.co/nomic-ai/modernbert-embed-base)
41
+ - **Maximum Sequence Length:** 8192 tokens
42
+ - **Output Dimensionality:** 768 dimensions
43
+ - **Similarity Function:** Cosine Similarity
44
+ - **Training Dataset:**
45
+ - parallel-sentences
46
+ - **Languages:** nl
47
+ - **License:** apache-2.0
48
+
49
+ ### Full Model Architecture
50
+
51
+ ```
52
+ SentenceTransformer(
53
+ (0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: ModernBertModel
54
+ (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
55
+ )
56
+ ```
57
+
58
+ ## Usage
59
+
60
+ **IMPORTANT:** While waiting for the next stable release of the `transformers` library, please install the latest git release to use `modernbert` models:
61
+
62
+ ```bash
63
+ pip install --upgrade git+https://github.com/huggingface/transformers.git
64
+ ```
65
+
66
+ The easiest way to use this model is to install the Sentence Transformers library:
67
+
68
+ ```bash
69
+ pip install -U sentence-transformers
70
+ ```
71
+
72
+ Then you can load this model and run inference.
73
+ ```python
74
+ from sentence_transformers import SentenceTransformer
75
+
76
+ # Download from the 🤗 Hub
77
+ model = SentenceTransformer("Parallia/Fairly-Multilingual-ModernBERT-Embed-BE-NL")
78
+ # Run inference
79
+ sentences = [
80
+ 'Er kwamen drie mysterieuze mannen ter hulp.',
81
+ 'Drie vreemde lui hielpte ons dan.',
82
+ 'Er kwamen drie zwarte vogels in onze tuin.',
83
+ 'Er zijn mensen die hulpzaam zijn.',
84
+ 'Een, twee, drie... Wie kan de volgende cijfers aanraden?',
85
+ ]
86
+ embeddings = model.encode(sentences)
87
+ print(embeddings.shape)
88
+ # [5, 768]
89
+
90
+ # Get the similarity scores for the embeddings
91
+ similarities = model.similarity(embeddings, embeddings)
92
+ print(similarities.shape)
93
+ # [5, 5]
94
+ ```
95
+
96
+ <!--
97
+ ### Recommendations
98
+
99
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
100
+ -->
101
+
102
+ ## Training Details
103
+
104
+ ### Training Dataset
105
+
106
+ #### parallel-sentences
107
+
108
+ * Dataset: parallel dataset
109
+ * Size: 8,066,634 training samples
110
+ * Columns: <code>sent1</code> and <code>sent2</code>
111
+ * Approximate statistics based on the first 1000 samples:
112
+ | | sent1 | sent2 |
113
+ |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
114
+ | type | string | string |
115
+ | details | <ul><li>min: 6 tokens</li><li>mean: 17.86 tokens</li><li>max: 46 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 18.87 tokens</li><li>max: 52 tokens</li></ul> |
116
+ * Samples:
117
+ | sent1 | sent2 |
118
+ |:----------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
119
+ | <code>The faces may change, but the essential views that have characterised Israel’s government for decades will remain the same after 9 April</code> | <code>Les visages peuvent changer, mais les opinions fondamentales qui caractérisent le gouvernement israélien depuis des décennies resteront les mêmes après le 9 avril</code> |
120
+ | <code>- Yeah. My husband never talked about business.</code> | <code>M'n man had het nooit over z'n zaken.</code> |
121
+ | <code>Or do they think that We hear not their secrets and their private counsels?</code> | <code>Oder meinen sie, daß Wir ihre Geheimnisse und heimlichen Beratungen nicht hören?</code> |
122
+ * Loss: [<code>MultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
123
+ ```json
124
+ {
125
+ "scale": 20.0,
126
+ "similarity_fct": "cos_sim"
127
+ }
128
+ ```
129
+
130
+ ### Training Hyperparameters
131
+ #### Non-Default Hyperparameters
132
+
133
+ - `eval_strategy`: steps
134
+ - `per_device_train_batch_size`: 256
135
+ - `per_device_eval_batch_size`: 256
136
+ - `learning_rate`: 2e-05
137
+ - `num_train_epochs`: 1
138
+ - `warmup_ratio`: 0.1
139
+ - `bf16`: True
140
+
141
+ #### All Hyperparameters
142
+ <details><summary>Click to expand</summary>
143
+
144
+ - `overwrite_output_dir`: False
145
+ - `do_predict`: False
146
+ - `eval_strategy`: steps
147
+ - `prediction_loss_only`: True
148
+ - `per_device_train_batch_size`: 256
149
+ - `per_device_eval_batch_size`: 256
150
+ - `per_gpu_train_batch_size`: None
151
+ - `per_gpu_eval_batch_size`: None
152
+ - `gradient_accumulation_steps`: 1
153
+ - `eval_accumulation_steps`: None
154
+ - `torch_empty_cache_steps`: None
155
+ - `learning_rate`: 2e-05
156
+ - `weight_decay`: 0.0
157
+ - `adam_beta1`: 0.9
158
+ - `adam_beta2`: 0.999
159
+ - `adam_epsilon`: 1e-08
160
+ - `max_grad_norm`: 1.0
161
+ - `num_train_epochs`: 1
162
+ - `max_steps`: -1
163
+ - `lr_scheduler_type`: linear
164
+ - `lr_scheduler_kwargs`: {}
165
+ - `warmup_ratio`: 0.1
166
+ - `warmup_steps`: 0
167
+ - `log_level`: passive
168
+ - `log_level_replica`: warning
169
+ - `log_on_each_node`: True
170
+ - `logging_nan_inf_filter`: True
171
+ - `save_safetensors`: True
172
+ - `save_on_each_node`: False
173
+ - `save_only_model`: False
174
+ - `restore_callback_states_from_checkpoint`: False
175
+ - `no_cuda`: False
176
+ - `use_cpu`: False
177
+ - `use_mps_device`: False
178
+ - `seed`: 42
179
+ - `data_seed`: None
180
+ - `jit_mode_eval`: False
181
+ - `use_ipex`: False
182
+ - `bf16`: True
183
+ - `fp16`: False
184
+ - `fp16_opt_level`: O1
185
+ - `half_precision_backend`: auto
186
+ - `bf16_full_eval`: False
187
+ - `fp16_full_eval`: False
188
+ - `tf32`: None
189
+ - `local_rank`: 0
190
+ - `ddp_backend`: None
191
+ - `tpu_num_cores`: None
192
+ - `tpu_metrics_debug`: False
193
+ - `debug`: []
194
+ - `dataloader_drop_last`: False
195
+ - `dataloader_num_workers`: 0
196
+ - `dataloader_prefetch_factor`: None
197
+ - `past_index`: -1
198
+ - `disable_tqdm`: False
199
+ - `remove_unused_columns`: True
200
+ - `label_names`: None
201
+ - `load_best_model_at_end`: False
202
+ - `ignore_data_skip`: False
203
+ - `fsdp`: []
204
+ - `fsdp_min_num_params`: 0
205
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
206
+ - `fsdp_transformer_layer_cls_to_wrap`: None
207
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
208
+ - `deepspeed`: None
209
+ - `label_smoothing_factor`: 0.0
210
+ - `optim`: adamw_torch
211
+ - `optim_args`: None
212
+ - `adafactor`: False
213
+ - `group_by_length`: False
214
+ - `length_column_name`: length
215
+ - `ddp_find_unused_parameters`: None
216
+ - `ddp_bucket_cap_mb`: None
217
+ - `ddp_broadcast_buffers`: False
218
+ - `dataloader_pin_memory`: True
219
+ - `dataloader_persistent_workers`: False
220
+ - `skip_memory_metrics`: True
221
+ - `use_legacy_prediction_loop`: False
222
+ - `push_to_hub`: False
223
+ - `resume_from_checkpoint`: None
224
+ - `hub_model_id`: None
225
+ - `hub_strategy`: every_save
226
+ - `hub_private_repo`: None
227
+ - `hub_always_push`: False
228
+ - `gradient_checkpointing`: False
229
+ - `gradient_checkpointing_kwargs`: None
230
+ - `include_inputs_for_metrics`: False
231
+ - `include_for_metrics`: []
232
+ - `eval_do_concat_batches`: True
233
+ - `fp16_backend`: auto
234
+ - `push_to_hub_model_id`: None
235
+ - `push_to_hub_organization`: None
236
+ - `mp_parameters`:
237
+ - `auto_find_batch_size`: False
238
+ - `full_determinism`: False
239
+ - `torchdynamo`: None
240
+ - `ray_scope`: last
241
+ - `ddp_timeout`: 1800
242
+ - `torch_compile`: False
243
+ - `torch_compile_backend`: None
244
+ - `torch_compile_mode`: None
245
+ - `dispatch_batches`: None
246
+ - `split_batches`: None
247
+ - `include_tokens_per_second`: False
248
+ - `include_num_input_tokens_seen`: False
249
+ - `neftune_noise_alpha`: None
250
+ - `optim_target_modules`: None
251
+ - `batch_eval_metrics`: False
252
+ - `eval_on_start`: False
253
+ - `use_liger_kernel`: False
254
+ - `eval_use_gather_object`: False
255
+ - `average_tokens_across_devices`: False
256
+ - `prompts`: None
257
+ - `batch_sampler`: batch_sampler
258
+ - `multi_dataset_batch_sampler`: proportional
259
+
260
+ </details>
261
+
262
+ ### Framework Versions
263
+ - Python: 3.11.7
264
+ - Sentence Transformers: 3.3.1
265
+ - Transformers: 4.48.0.dev0
266
+ - PyTorch: 2.2.0+cu121
267
+ - Accelerate: 1.0.1
268
+ - Datasets: 3.2.0
269
+ - Tokenizers: 0.21.0
270
+
271
+ ## Citation
272
+
273
+ If you use or finetune this model, please consider citing this paper and the sentence-transformers library:
274
+
275
+ ### BibTeX
276
+
277
+ ### This model
278
+ ```bibtex
279
+ @misc{henderson2017efficient,
280
+ title={The Fairly Multilingual ModernBERT Embbeding Model -- Belgian Edition},
281
+ author={Francois Remy},
282
+ year={2025},
283
+ eprint={2501.99999},
284
+ archivePrefix={arXiv},
285
+ primaryClass={cs.CL}
286
+ }
287
+ ```
288
+
289
+ #### Sentence Transformers
290
+ ```bibtex
291
+ @inproceedings{reimers-2019-sentence-bert,
292
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
293
+ author = "Reimers, Nils and Gurevych, Iryna",
294
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
295
+ month = "11",
296
+ year = "2019",
297
+ publisher = "Association for Computational Linguistics",
298
+ url = "https://arxiv.org/abs/1908.10084",
299
+ }
300
+ ```
config.json ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "./output/nomic-ai--modernbert-embed-base--belgian-edition",
3
+ "additional_special_tokens_ids": [],
4
+ "architectures": [
5
+ "ModernBertModel"
6
+ ],
7
+ "attention_bias": false,
8
+ "attention_dropout": 0.0,
9
+ "bos_token_id": 1,
10
+ "classifier_activation": "gelu",
11
+ "classifier_bias": false,
12
+ "classifier_dropout": 0.0,
13
+ "classifier_pooling": "mean",
14
+ "cls_token_id": null,
15
+ "decoder_bias": true,
16
+ "deterministic_flash_attn": false,
17
+ "embedding_dropout": 0.0,
18
+ "eos_token_id": 2,
19
+ "global_attn_every_n_layers": 3,
20
+ "global_rope_theta": 160000.0,
21
+ "gradient_checkpointing": false,
22
+ "hidden_activation": "gelu",
23
+ "hidden_size": 768,
24
+ "initializer_cutoff_factor": 2.0,
25
+ "initializer_range": 0.02,
26
+ "intermediate_size": 1152,
27
+ "layer_norm_eps": 1e-05,
28
+ "local_attention": 128,
29
+ "local_rope_theta": 10000.0,
30
+ "mask_token_id": null,
31
+ "max_position_embeddings": 8192,
32
+ "mlp_bias": false,
33
+ "mlp_dropout": 0.0,
34
+ "model_type": "modernbert",
35
+ "norm_bias": false,
36
+ "norm_eps": 1e-05,
37
+ "num_attention_heads": 12,
38
+ "num_hidden_layers": 22,
39
+ "pad_token_id": null,
40
+ "position_embedding_type": "absolute",
41
+ "reference_compile": false,
42
+ "sep_token_id": null,
43
+ "sparse_pred_ignore_index": -100,
44
+ "sparse_prediction": false,
45
+ "tokenizer_class": "LlamaTokenizerFast",
46
+ "torch_dtype": "float32",
47
+ "transformers_version": "4.48.0.dev0",
48
+ "unk_token_id": 0,
49
+ "vocab_size": 50000
50
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.3.1",
4
+ "transformers": "4.48.0.dev0",
5
+ "pytorch": "2.2.0+cu121"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": "cosine"
10
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8be07d566dc02a8bcc5f3b4f132a94a4623d16b8ffde20e825bb254ef830890
3
+ size 594939640
modules.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.models.Transformer"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Pooling",
12
+ "type": "sentence_transformers.models.Pooling"
13
+ }
14
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 8192,
3
+ "do_lower_case": false
4
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "unk_token": {
17
+ "content": "<unk>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ }
23
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dd7eaec915e95925cf72c45a4ef52c6439d0d99b55b8b2e36651cdc2d24d30c1
3
+ size 1085613
tokenizer_config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "add_prefix_space": null,
5
+ "added_tokens_decoder": {
6
+ "0": {
7
+ "content": "<unk>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "1": {
15
+ "content": "<s>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "2": {
23
+ "content": "</s>",
24
+ "lstrip": false,
25
+ "normalized": false,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": true
29
+ }
30
+ },
31
+ "bos_token": "<s>",
32
+ "clean_up_tokenization_spaces": false,
33
+ "eos_token": "</s>",
34
+ "extra_special_tokens": {},
35
+ "legacy": true,
36
+ "model_max_length": 1000000000000000019884624838656,
37
+ "pad_token": null,
38
+ "sp_model_kwargs": {},
39
+ "spaces_between_special_tokens": false,
40
+ "tokenizer_class": "LlamaTokenizer",
41
+ "unk_token": "<unk>",
42
+ "use_default_system_prompt": false
43
+ }