kiel2 commited on
Commit
0bf7915
·
verified ·
1 Parent(s): 7872b69

Upload multi-domain fine-tuned KielEmbed-Code weights

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "embedding_dimension": 768,
3
+ "pooling_mode": "mean",
4
+ "include_prompt": true
5
+ }
README.md ADDED
@@ -0,0 +1,370 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - sentence-transformers
4
+ - sentence-similarity
5
+ - feature-extraction
6
+ - dense
7
+ - generated_from_trainer
8
+ - dataset_size:10000
9
+ - loss:CosineSimilarityLoss
10
+ base_model: microsoft/codebert-base
11
+ widget:
12
+ - source_sentence: But Close wondered whether the package would be worth the cost
13
+ of licensing the third-party software , along with Salesforce.com 's rental price
14
+ .
15
+ sentences:
16
+ - Close also questions whether it would be worth the cost of licensing third-party
17
+ software , along with Salesforce.com 's rental price .
18
+ - No tumors were detected ; rather , empty cavities and scar tissue were found in
19
+ their place .
20
+ - A race observer sits in the passenger seat of the follow vehicle to record any
21
+ broken rules and also keep track of the car 's time .
22
+ - source_sentence: Almihdhar and Alhazmi were aboard American Airlines Flight 77 ,
23
+ which crashed into the Pentagon .
24
+ sentences:
25
+ - Both have been identified as some of the hijackers who flew American Airlines
26
+ Flight 77 into the Pentagon .
27
+ - '" The Congress of the United States has never — ever — outlawed a medical procedure
28
+ , " said Rep. Louise McIntosh Slaughter ( D-N.Y. ) .'
29
+ - The agency wants him to return the illegal proceeds with interest and pay civil
30
+ monetary penalties .
31
+ - source_sentence: He also called Hovan a " person of good reputation " who had worked
32
+ as a bus driver since 1967 .
33
+ sentences:
34
+ - The other victim , Michael Walker , of 550 Barbey Street , was struck in the neck
35
+ .
36
+ - The Fijian military installed an all-indigenous government led by Mr Qarase ,
37
+ who won democratic elections in September 2001 .
38
+ - Hovan , a resident of Trumbull , Conn . , had worked as a bus driver since 1967
39
+ and had no prior criminal record .
40
+ - source_sentence: Had the creditors turned down the bailout plan , LG Group might
41
+ have been forced to close down its credit card business .
42
+ sentences:
43
+ - If the creditors turn down the bailout plan , LG Group may have to closedown its
44
+ card business .
45
+ - Passengers on that cruise are to be given a refund and voucher for another trip
46
+ .
47
+ - '" People who were on their way home , all of a sudden taken from us , " Mr. Bloomberg
48
+ said of the collision .'
49
+ - source_sentence: '" Any decision on Charleroi will have huge implications for regional
50
+ airports in France , " he said .'
51
+ sentences:
52
+ - '" A bad decision on Charleroi would have huge implications for state-owned regional
53
+ airports in France .'
54
+ - Launched from space shuttle Atlantis ( news - web sites ) in 1989 , Galileo will
55
+ have traveled about 2.8 billion miles by the time it hits Jupiter .
56
+ - He said the ferry 's crew will be interviewed and tested for drugs and alcohol
57
+ .
58
+ pipeline_tag: sentence-similarity
59
+ library_name: sentence-transformers
60
+ ---
61
+
62
+ # SentenceTransformer based on microsoft/codebert-base
63
+
64
+ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [microsoft/codebert-base](https://huggingface.co/microsoft/codebert-base). It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, classification, clustering, and more.
65
+
66
+ ## Model Details
67
+
68
+ ### Model Description
69
+ - **Model Type:** Sentence Transformer
70
+ - **Base model:** [microsoft/codebert-base](https://huggingface.co/microsoft/codebert-base) <!-- at revision 3b0952feddeffad0063f274080e3c23d75e7eb39 -->
71
+ - **Maximum Sequence Length:** 512 tokens
72
+ - **Output Dimensionality:** 768 dimensions
73
+ - **Similarity Function:** Cosine Similarity
74
+ - **Supported Modality:** Text
75
+ <!-- - **Training Dataset:** Unknown -->
76
+ <!-- - **Language:** Unknown -->
77
+ <!-- - **License:** Unknown -->
78
+
79
+ ### Model Sources
80
+
81
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
82
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers)
83
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
84
+
85
+ ### Full Model Architecture
86
+
87
+ ```
88
+ SentenceTransformer(
89
+ (0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'RobertaModel'})
90
+ (1): Pooling({'embedding_dimension': 768, 'pooling_mode': 'mean', 'include_prompt': True})
91
+ )
92
+ ```
93
+
94
+ ## Usage
95
+
96
+ ### Direct Usage (Sentence Transformers)
97
+
98
+ First install the Sentence Transformers library:
99
+
100
+ ```bash
101
+ pip install -U sentence-transformers
102
+ ```
103
+ Then you can load this model and run inference.
104
+ ```python
105
+ from sentence_transformers import SentenceTransformer
106
+
107
+ # Download from the 🤗 Hub
108
+ model = SentenceTransformer("sentence_transformers_model_id")
109
+ # Run inference
110
+ sentences = [
111
+ '" Any decision on Charleroi will have huge implications for regional airports in France , " he said .',
112
+ '" A bad decision on Charleroi would have huge implications for state-owned regional airports in France .',
113
+ "He said the ferry 's crew will be interviewed and tested for drugs and alcohol .",
114
+ ]
115
+ embeddings = model.encode(sentences)
116
+ print(embeddings.shape)
117
+ # [3, 768]
118
+
119
+ # Get the similarity scores for the embeddings
120
+ similarities = model.similarity(embeddings, embeddings)
121
+ print(similarities)
122
+ # tensor([[1.0000, 0.9671, 0.9596],
123
+ # [0.9671, 1.0000, 0.9494],
124
+ # [0.9596, 0.9494, 1.0000]])
125
+ ```
126
+ <!--
127
+ ### Direct Usage (Transformers)
128
+
129
+ <details><summary>Click to see the direct usage in Transformers</summary>
130
+
131
+ </details>
132
+ -->
133
+
134
+ <!--
135
+ ### Downstream Usage (Sentence Transformers)
136
+
137
+ You can finetune this model on your own dataset.
138
+
139
+ <details><summary>Click to expand</summary>
140
+
141
+ </details>
142
+ -->
143
+
144
+ <!--
145
+ ### Out-of-Scope Use
146
+
147
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
148
+ -->
149
+
150
+ <!--
151
+ ## Bias, Risks and Limitations
152
+
153
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
154
+ -->
155
+
156
+ <!--
157
+ ### Recommendations
158
+
159
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
160
+ -->
161
+
162
+ ## Training Details
163
+
164
+ ### Training Dataset
165
+
166
+ #### Unnamed Dataset
167
+
168
+ * Size: 10,000 training samples
169
+ * Columns: <code>text1</code>, <code>text2</code>, and <code>label</code>
170
+ * Approximate statistics based on the first 100 samples:
171
+ | | text1 | text2 | label |
172
+ |:---------|:----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|:------------------------------------------------|
173
+ | type | string | string | int |
174
+ | modality | text | text | |
175
+ | details | <ul><li>min: 12 tokens</li><li>mean: 27.7 tokens</li><li>max: 41 tokens</li></ul> | <ul><li>min: 15 tokens</li><li>mean: 27.64 tokens</li><li>max: 46 tokens</li></ul> | <ul><li>0: ~34.62%</li><li>1: ~65.38%</li></ul> |
176
+ * Samples:
177
+ | text1 | text2 | label |
178
+ |:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------|
179
+ | <code>" The public is understandably losing patience with these unwanted phone calls , unwanted intrusions , " he said at a White House ceremony .</code> | <code>" While many good people work in the telemarketing industry , the public is understandably losing patience with these unwanted phone calls , unwanted intrusions , " Mr. Bush said .</code> | <code>0</code> |
180
+ | <code>Federal agent Bill Polychronopoulos said it was not known if the man , 30 , would be charged .</code> | <code>Federal Agent Bill Polychronopoulos said last night the man involved in the Melbourne incident had been unarmed .</code> | <code>0</code> |
181
+ | <code>The companies uniformly declined to give specific numbers on customer turnover , saying they will release those figures only when they report overall company performance at year-end .</code> | <code>The companies , however , declined to give specifics on customer turnover , saying they would release figures only when they report their overall company performance .</code> | <code>1</code> |
182
+ * Loss: [<code>CosineSimilarityLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosinesimilarityloss) with these parameters:
183
+ ```json
184
+ {
185
+ "loss_fct": "torch.nn.modules.loss.MSELoss",
186
+ "cos_score_transformation": "torch.nn.modules.linear.Identity"
187
+ }
188
+ ```
189
+
190
+ ### Training Hyperparameters
191
+ #### Non-Default Hyperparameters
192
+
193
+ - `num_train_epochs`: 1
194
+ - `learning_rate`: 2e-05
195
+ - `warmup_steps`: 0.1
196
+ - `gradient_accumulation_steps`: 4
197
+ - `fp16`: True
198
+
199
+ #### All Hyperparameters
200
+ <details><summary>Click to expand</summary>
201
+
202
+ - `per_device_train_batch_size`: 8
203
+ - `num_train_epochs`: 1
204
+ - `max_steps`: -1
205
+ - `learning_rate`: 2e-05
206
+ - `lr_scheduler_type`: linear
207
+ - `lr_scheduler_kwargs`: None
208
+ - `warmup_steps`: 0.1
209
+ - `optim`: adamw_torch_fused
210
+ - `optim_args`: None
211
+ - `weight_decay`: 0.0
212
+ - `adam_beta1`: 0.9
213
+ - `adam_beta2`: 0.999
214
+ - `adam_epsilon`: 1e-08
215
+ - `optim_target_modules`: None
216
+ - `gradient_accumulation_steps`: 4
217
+ - `average_tokens_across_devices`: True
218
+ - `max_grad_norm`: 1.0
219
+ - `label_smoothing_factor`: 0.0
220
+ - `bf16`: False
221
+ - `fp16`: True
222
+ - `bf16_full_eval`: False
223
+ - `fp16_full_eval`: False
224
+ - `tf32`: None
225
+ - `gradient_checkpointing`: False
226
+ - `gradient_checkpointing_kwargs`: None
227
+ - `torch_compile`: False
228
+ - `torch_compile_backend`: None
229
+ - `torch_compile_mode`: None
230
+ - `use_liger_kernel`: False
231
+ - `liger_kernel_config`: None
232
+ - `use_cache`: False
233
+ - `neftune_noise_alpha`: None
234
+ - `torch_empty_cache_steps`: None
235
+ - `auto_find_batch_size`: False
236
+ - `log_on_each_node`: True
237
+ - `logging_nan_inf_filter`: True
238
+ - `include_num_input_tokens_seen`: no
239
+ - `log_level`: passive
240
+ - `log_level_replica`: warning
241
+ - `disable_tqdm`: False
242
+ - `project`: huggingface
243
+ - `trackio_space_id`: None
244
+ - `trackio_bucket_id`: None
245
+ - `trackio_static_space_id`: None
246
+ - `per_device_eval_batch_size`: 8
247
+ - `prediction_loss_only`: True
248
+ - `eval_on_start`: False
249
+ - `eval_do_concat_batches`: True
250
+ - `eval_use_gather_object`: False
251
+ - `eval_accumulation_steps`: None
252
+ - `include_for_metrics`: []
253
+ - `batch_eval_metrics`: False
254
+ - `save_only_model`: False
255
+ - `save_on_each_node`: False
256
+ - `enable_jit_checkpoint`: False
257
+ - `push_to_hub`: False
258
+ - `hub_private_repo`: None
259
+ - `hub_model_id`: None
260
+ - `hub_strategy`: every_save
261
+ - `hub_always_push`: False
262
+ - `hub_revision`: None
263
+ - `load_best_model_at_end`: False
264
+ - `ignore_data_skip`: False
265
+ - `restore_callback_states_from_checkpoint`: False
266
+ - `full_determinism`: False
267
+ - `seed`: 42
268
+ - `data_seed`: None
269
+ - `use_cpu`: False
270
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
271
+ - `parallelism_config`: None
272
+ - `dataloader_drop_last`: False
273
+ - `dataloader_num_workers`: 0
274
+ - `dataloader_pin_memory`: True
275
+ - `dataloader_persistent_workers`: False
276
+ - `dataloader_prefetch_factor`: None
277
+ - `dataloader_multiprocessing_context`: None
278
+ - `dataloader_in_order`: True
279
+ - `remove_unused_columns`: True
280
+ - `label_names`: None
281
+ - `train_sampling_strategy`: random
282
+ - `length_column_name`: length
283
+ - `ddp_find_unused_parameters`: None
284
+ - `ddp_bucket_cap_mb`: None
285
+ - `ddp_broadcast_buffers`: False
286
+ - `ddp_static_graph`: None
287
+ - `ddp_backend`: None
288
+ - `ddp_timeout`: 1800
289
+ - `fsdp`: None
290
+ - `fsdp_config`: None
291
+ - `deepspeed`: None
292
+ - `debug`: []
293
+ - `skip_memory_metrics`: True
294
+ - `do_predict`: False
295
+ - `resume_from_checkpoint`: None
296
+ - `local_rank`: -1
297
+ - `prompts`: None
298
+ - `batch_sampler`: batch_sampler
299
+ - `multi_dataset_batch_sampler`: proportional
300
+ - `router_mapping`: {}
301
+ - `learning_rate_mapping`: {}
302
+ - `warmup_ratio`: None
303
+
304
+ </details>
305
+
306
+ ### Training Logs
307
+ | Epoch | Step | Training Loss |
308
+ |:-----:|:----:|:-------------:|
309
+ | 0.16 | 50 | 28.0752 |
310
+ | 0.32 | 100 | 24.7668 |
311
+ | 0.48 | 150 | 21.0055 |
312
+ | 0.64 | 200 | 26.5538 |
313
+ | 0.8 | 250 | 26.0600 |
314
+ | 0.96 | 300 | 26.3027 |
315
+
316
+
317
+ ### Training Time
318
+ - **Training**: 5.1 minutes
319
+
320
+ ### Framework Versions
321
+ - Python: 3.13.15
322
+ - Sentence Transformers: 5.7.0
323
+ - Transformers: 5.16.1
324
+ - PyTorch: 2.11.0+cu128
325
+ - Accelerate: 1.14.0
326
+ - Datasets: 4.8.5
327
+ - Tokenizers: 0.23.1
328
+
329
+ ## Additional Resources
330
+
331
+ - [Training and Finetuning Embedding Models with Sentence Transformers](https://huggingface.co/blog/train-sentence-transformers): the end-to-end guide for training or finetuning Sentence Transformer models.
332
+ - [Introduction to Matryoshka Embedding Models](https://huggingface.co/blog/matryoshka): variable-size embeddings that can be truncated with minimal quality loss.
333
+ - [Binary and Scalar Embedding Quantization for Significantly Faster & Cheaper Retrieval](https://huggingface.co/blog/embedding-quantization): post-training compression of embedding vectors.
334
+ - [Multimodal Embedding & Reranker Models with Sentence Transformers](https://huggingface.co/blog/multimodal-sentence-transformers): use text, image, audio, and video models through the same API.
335
+ - [Training and Finetuning Multimodal Embedding & Reranker Models with Sentence Transformers](https://huggingface.co/blog/train-multimodal-sentence-transformers): train multimodal embedding models, with a Visual Document Retrieval walkthrough.
336
+
337
+ ## Citation
338
+
339
+ ### BibTeX
340
+
341
+ #### Sentence Transformers
342
+ ```bibtex
343
+ @inproceedings{reimers-2019-sentence-bert,
344
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
345
+ author = "Reimers, Nils and Gurevych, Iryna",
346
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
347
+ month = "11",
348
+ year = "2019",
349
+ publisher = "Association for Computational Linguistics",
350
+ url = "https://arxiv.org/abs/1908.10084",
351
+ }
352
+ ```
353
+
354
+ <!--
355
+ ## Glossary
356
+
357
+ *Clearly define terms in order to be accessible across audiences.*
358
+ -->
359
+
360
+ <!--
361
+ ## Model Card Authors
362
+
363
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
364
+ -->
365
+
366
+ <!--
367
+ ## Model Card Contact
368
+
369
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
370
+ -->
config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_cross_attention": false,
3
+ "architectures": [
4
+ "RobertaModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "classifier_dropout": null,
9
+ "dtype": "float32",
10
+ "eos_token_id": 2,
11
+ "hidden_act": "gelu",
12
+ "hidden_dropout_prob": 0.1,
13
+ "hidden_size": 768,
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 3072,
16
+ "is_decoder": false,
17
+ "layer_norm_eps": 1e-05,
18
+ "max_position_embeddings": 514,
19
+ "model_type": "roberta",
20
+ "num_attention_heads": 12,
21
+ "num_hidden_layers": 12,
22
+ "output_past": true,
23
+ "pad_token_id": 1,
24
+ "tie_word_embeddings": true,
25
+ "transformers_version": "5.16.1",
26
+ "type_vocab_size": 1,
27
+ "use_cache": false,
28
+ "vocab_size": 50265
29
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "pytorch": "2.11.0+cu128",
4
+ "sentence_transformers": "5.7.0",
5
+ "transformers": "5.16.1"
6
+ },
7
+ "default_prompt_name": null,
8
+ "model_type": "SentenceTransformer",
9
+ "prompts": {
10
+ "document": "",
11
+ "query": ""
12
+ },
13
+ "similarity_fn_name": "cosine"
14
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:73ed267e458fd7704f64f9447b43204a84f689cb3fa8a2936a2289fca33af540
3
+ size 498604904
modules.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.base.modules.transformer.Transformer"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Pooling",
12
+ "type": "sentence_transformers.sentence_transformer.modules.pooling.Pooling"
13
+ }
14
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "transformer_task": "feature-extraction",
3
+ "modality_config": {
4
+ "text": {
5
+ "method": "forward",
6
+ "method_output_name": "last_hidden_state"
7
+ }
8
+ },
9
+ "module_output_name": "token_embeddings"
10
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<s>",
5
+ "cls_token": "<s>",
6
+ "eos_token": "</s>",
7
+ "errors": "replace",
8
+ "is_local": false,
9
+ "local_files_only": false,
10
+ "mask_token": "<mask>",
11
+ "model_max_length": 512,
12
+ "pad_token": "<pad>",
13
+ "sep_token": "</s>",
14
+ "tokenizer_class": "RobertaTokenizer",
15
+ "trim_offsets": true,
16
+ "unk_token": "<unk>"
17
+ }