ostoveland commited on
Commit
7febe91
1 Parent(s): 0683949

Add new SentenceTransformer model.

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 768,
3
+ "pooling_mode_cls_token": false,
4
+ "pooling_mode_mean_tokens": true,
5
+ "pooling_mode_max_tokens": false,
6
+ "pooling_mode_mean_sqrt_len_tokens": false,
7
+ "pooling_mode_weightedmean_tokens": false,
8
+ "pooling_mode_lasttoken": false,
9
+ "include_prompt": true
10
+ }
README.md ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: sentence-transformers/distilbert-base-nli-mean-tokens
3
+ datasets: []
4
+ language: []
5
+ library_name: sentence-transformers
6
+ pipeline_tag: sentence-similarity
7
+ tags:
8
+ - sentence-transformers
9
+ - sentence-similarity
10
+ - feature-extraction
11
+ - generated_from_trainer
12
+ - dataset_size:2
13
+ - loss:CosineSimilarityLoss
14
+ widget: []
15
+ ---
16
+
17
+ # SentenceTransformer based on sentence-transformers/distilbert-base-nli-mean-tokens
18
+
19
+ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [sentence-transformers/distilbert-base-nli-mean-tokens](https://huggingface.co/sentence-transformers/distilbert-base-nli-mean-tokens). 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.
20
+
21
+ ## Model Details
22
+
23
+ ### Model Description
24
+ - **Model Type:** Sentence Transformer
25
+ - **Base model:** [sentence-transformers/distilbert-base-nli-mean-tokens](https://huggingface.co/sentence-transformers/distilbert-base-nli-mean-tokens) <!-- at revision 2781c006adbf3726b509caa8649fc8077ff0724d -->
26
+ - **Maximum Sequence Length:** 128 tokens
27
+ - **Output Dimensionality:** 768 tokens
28
+ - **Similarity Function:** Cosine Similarity
29
+ <!-- - **Training Dataset:** Unknown -->
30
+ <!-- - **Language:** Unknown -->
31
+ <!-- - **License:** Unknown -->
32
+
33
+ ### Model Sources
34
+
35
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
36
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
37
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
38
+
39
+ ### Full Model Architecture
40
+
41
+ ```
42
+ SentenceTransformer(
43
+ (0): Transformer({'max_seq_length': 128, 'do_lower_case': False}) with Transformer model: DistilBertModel
44
+ (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})
45
+ )
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ ### Direct Usage (Sentence Transformers)
51
+
52
+ First install the Sentence Transformers library:
53
+
54
+ ```bash
55
+ pip install -U sentence-transformers
56
+ ```
57
+
58
+ Then you can load this model and run inference.
59
+ ```python
60
+ from sentence_transformers import SentenceTransformer
61
+
62
+ # Download from the 🤗 Hub
63
+ model = SentenceTransformer("ostoveland/test8")
64
+ # Run inference
65
+ sentences = [
66
+ 'The weather is lovely today.',
67
+ "It's so sunny outside!",
68
+ 'He drove to the stadium.',
69
+ ]
70
+ embeddings = model.encode(sentences)
71
+ print(embeddings.shape)
72
+ # [3, 768]
73
+
74
+ # Get the similarity scores for the embeddings
75
+ similarities = model.similarity(embeddings, embeddings)
76
+ print(similarities.shape)
77
+ # [3, 3]
78
+ ```
79
+
80
+ <!--
81
+ ### Direct Usage (Transformers)
82
+
83
+ <details><summary>Click to see the direct usage in Transformers</summary>
84
+
85
+ </details>
86
+ -->
87
+
88
+ <!--
89
+ ### Downstream Usage (Sentence Transformers)
90
+
91
+ You can finetune this model on your own dataset.
92
+
93
+ <details><summary>Click to expand</summary>
94
+
95
+ </details>
96
+ -->
97
+
98
+ <!--
99
+ ### Out-of-Scope Use
100
+
101
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
102
+ -->
103
+
104
+ <!--
105
+ ## Bias, Risks and Limitations
106
+
107
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
108
+ -->
109
+
110
+ <!--
111
+ ### Recommendations
112
+
113
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
114
+ -->
115
+
116
+ ## Training Details
117
+
118
+ ### Training Dataset
119
+
120
+ #### Unnamed Dataset
121
+
122
+
123
+ * Size: 2 training samples
124
+ * Columns: <code>sentence_0</code>, <code>sentence_1</code>, and <code>label</code>
125
+ * Approximate statistics based on the first 1000 samples:
126
+ | | sentence_0 | sentence_1 | label |
127
+ |:--------|:-------------------------------------------------------------------------------|:-------------------------------------------------------------------------------|:--------------------------------------------------------------|
128
+ | type | string | string | float |
129
+ | details | <ul><li>min: 6 tokens</li><li>mean: 7.0 tokens</li><li>max: 8 tokens</li></ul> | <ul><li>min: 7 tokens</li><li>mean: 8.0 tokens</li><li>max: 9 tokens</li></ul> | <ul><li>min: 0.8</li><li>mean: 0.9</li><li>max: 1.0</li></ul> |
130
+ * Samples:
131
+ | sentence_0 | sentence_1 | label |
132
+ |:-------------------------------------|:---------------------------------------|:-----------------|
133
+ | <code>The dog is barking</code> | <code>A dog barks loudly</code> | <code>0.8</code> |
134
+ | <code>The cat sits on the mat</code> | <code>There is a cat on the mat</code> | <code>1.0</code> |
135
+ * Loss: [<code>CosineSimilarityLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosinesimilarityloss) with these parameters:
136
+ ```json
137
+ {
138
+ "loss_fct": "torch.nn.modules.loss.MSELoss"
139
+ }
140
+ ```
141
+
142
+ ### Training Hyperparameters
143
+ #### Non-Default Hyperparameters
144
+
145
+ - `per_device_train_batch_size`: 16
146
+ - `per_device_eval_batch_size`: 16
147
+ - `multi_dataset_batch_sampler`: round_robin
148
+
149
+ #### All Hyperparameters
150
+ <details><summary>Click to expand</summary>
151
+
152
+ - `overwrite_output_dir`: False
153
+ - `do_predict`: False
154
+ - `eval_strategy`: no
155
+ - `prediction_loss_only`: True
156
+ - `per_device_train_batch_size`: 16
157
+ - `per_device_eval_batch_size`: 16
158
+ - `per_gpu_train_batch_size`: None
159
+ - `per_gpu_eval_batch_size`: None
160
+ - `gradient_accumulation_steps`: 1
161
+ - `eval_accumulation_steps`: None
162
+ - `learning_rate`: 5e-05
163
+ - `weight_decay`: 0.0
164
+ - `adam_beta1`: 0.9
165
+ - `adam_beta2`: 0.999
166
+ - `adam_epsilon`: 1e-08
167
+ - `max_grad_norm`: 1
168
+ - `num_train_epochs`: 3
169
+ - `max_steps`: -1
170
+ - `lr_scheduler_type`: linear
171
+ - `lr_scheduler_kwargs`: {}
172
+ - `warmup_ratio`: 0.0
173
+ - `warmup_steps`: 0
174
+ - `log_level`: passive
175
+ - `log_level_replica`: warning
176
+ - `log_on_each_node`: True
177
+ - `logging_nan_inf_filter`: True
178
+ - `save_safetensors`: True
179
+ - `save_on_each_node`: False
180
+ - `save_only_model`: False
181
+ - `restore_callback_states_from_checkpoint`: False
182
+ - `no_cuda`: False
183
+ - `use_cpu`: False
184
+ - `use_mps_device`: False
185
+ - `seed`: 42
186
+ - `data_seed`: None
187
+ - `jit_mode_eval`: False
188
+ - `use_ipex`: False
189
+ - `bf16`: False
190
+ - `fp16`: False
191
+ - `fp16_opt_level`: O1
192
+ - `half_precision_backend`: auto
193
+ - `bf16_full_eval`: False
194
+ - `fp16_full_eval`: False
195
+ - `tf32`: None
196
+ - `local_rank`: 0
197
+ - `ddp_backend`: None
198
+ - `tpu_num_cores`: None
199
+ - `tpu_metrics_debug`: False
200
+ - `debug`: []
201
+ - `dataloader_drop_last`: False
202
+ - `dataloader_num_workers`: 0
203
+ - `dataloader_prefetch_factor`: None
204
+ - `past_index`: -1
205
+ - `disable_tqdm`: False
206
+ - `remove_unused_columns`: True
207
+ - `label_names`: None
208
+ - `load_best_model_at_end`: False
209
+ - `ignore_data_skip`: False
210
+ - `fsdp`: []
211
+ - `fsdp_min_num_params`: 0
212
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
213
+ - `fsdp_transformer_layer_cls_to_wrap`: None
214
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
215
+ - `deepspeed`: None
216
+ - `label_smoothing_factor`: 0.0
217
+ - `optim`: adamw_torch
218
+ - `optim_args`: None
219
+ - `adafactor`: False
220
+ - `group_by_length`: False
221
+ - `length_column_name`: length
222
+ - `ddp_find_unused_parameters`: None
223
+ - `ddp_bucket_cap_mb`: None
224
+ - `ddp_broadcast_buffers`: False
225
+ - `dataloader_pin_memory`: True
226
+ - `dataloader_persistent_workers`: False
227
+ - `skip_memory_metrics`: True
228
+ - `use_legacy_prediction_loop`: False
229
+ - `push_to_hub`: False
230
+ - `resume_from_checkpoint`: None
231
+ - `hub_model_id`: None
232
+ - `hub_strategy`: every_save
233
+ - `hub_private_repo`: False
234
+ - `hub_always_push`: False
235
+ - `gradient_checkpointing`: False
236
+ - `gradient_checkpointing_kwargs`: None
237
+ - `include_inputs_for_metrics`: False
238
+ - `eval_do_concat_batches`: True
239
+ - `fp16_backend`: auto
240
+ - `push_to_hub_model_id`: None
241
+ - `push_to_hub_organization`: None
242
+ - `mp_parameters`:
243
+ - `auto_find_batch_size`: False
244
+ - `full_determinism`: False
245
+ - `torchdynamo`: None
246
+ - `ray_scope`: last
247
+ - `ddp_timeout`: 1800
248
+ - `torch_compile`: False
249
+ - `torch_compile_backend`: None
250
+ - `torch_compile_mode`: None
251
+ - `dispatch_batches`: None
252
+ - `split_batches`: None
253
+ - `include_tokens_per_second`: False
254
+ - `include_num_input_tokens_seen`: False
255
+ - `neftune_noise_alpha`: None
256
+ - `optim_target_modules`: None
257
+ - `batch_eval_metrics`: False
258
+ - `batch_sampler`: batch_sampler
259
+ - `multi_dataset_batch_sampler`: round_robin
260
+
261
+ </details>
262
+
263
+ ### Framework Versions
264
+ - Python: 3.10.12
265
+ - Sentence Transformers: 3.0.1
266
+ - Transformers: 4.41.2
267
+ - PyTorch: 2.3.1+cu121
268
+ - Accelerate: 0.31.0
269
+ - Datasets: 2.20.0
270
+ - Tokenizers: 0.19.1
271
+
272
+ ## Citation
273
+
274
+ ### BibTeX
275
+
276
+ #### Sentence Transformers
277
+ ```bibtex
278
+ @inproceedings{reimers-2019-sentence-bert,
279
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
280
+ author = "Reimers, Nils and Gurevych, Iryna",
281
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
282
+ month = "11",
283
+ year = "2019",
284
+ publisher = "Association for Computational Linguistics",
285
+ url = "https://arxiv.org/abs/1908.10084",
286
+ }
287
+ ```
288
+
289
+ <!--
290
+ ## Glossary
291
+
292
+ *Clearly define terms in order to be accessible across audiences.*
293
+ -->
294
+
295
+ <!--
296
+ ## Model Card Authors
297
+
298
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
299
+ -->
300
+
301
+ <!--
302
+ ## Model Card Contact
303
+
304
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
305
+ -->
config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "sentence-transformers/distilbert-base-nli-mean-tokens",
3
+ "activation": "gelu",
4
+ "architectures": [
5
+ "DistilBertModel"
6
+ ],
7
+ "attention_dropout": 0.1,
8
+ "dim": 768,
9
+ "dropout": 0.1,
10
+ "hidden_dim": 3072,
11
+ "initializer_range": 0.02,
12
+ "max_position_embeddings": 512,
13
+ "model_type": "distilbert",
14
+ "n_heads": 12,
15
+ "n_layers": 6,
16
+ "pad_token_id": 0,
17
+ "qa_dropout": 0.1,
18
+ "seq_classif_dropout": 0.2,
19
+ "sinusoidal_pos_embds": false,
20
+ "tie_weights_": true,
21
+ "torch_dtype": "float32",
22
+ "transformers_version": "4.41.2",
23
+ "vocab_size": 30522
24
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.0.1",
4
+ "transformers": "4.41.2",
5
+ "pytorch": "2.3.1+cu121"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": null
10
+ }
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
+ ]
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c602afe32129d28d90ef191ee38c5215c7c22b47a0fb15301d8ccc473f533069
3
+ size 265485146
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 128,
3
+ "do_lower_case": false
4
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": {
3
+ "content": "[CLS]",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "mask_token": {
10
+ "content": "[MASK]",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "[PAD]",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "sep_token": {
24
+ "content": "[SEP]",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "unk_token": {
31
+ "content": "[UNK]",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ }
37
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "100": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "101": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "102": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "103": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "clean_up_tokenization_spaces": true,
45
+ "cls_token": "[CLS]",
46
+ "do_basic_tokenize": true,
47
+ "do_lower_case": true,
48
+ "mask_token": "[MASK]",
49
+ "model_max_length": 128,
50
+ "never_split": null,
51
+ "pad_token": "[PAD]",
52
+ "sep_token": "[SEP]",
53
+ "strip_accents": null,
54
+ "tokenize_chinese_chars": true,
55
+ "tokenizer_class": "DistilBertTokenizer",
56
+ "unk_token": "[UNK]"
57
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff