LeoChiuu commited on
Commit
7bfb01e
1 Parent(s): 04ea0c6

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,366 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: colorfulscoop/sbert-base-ja
3
+ datasets: []
4
+ language: []
5
+ library_name: sentence-transformers
6
+ metrics:
7
+ - accuracy
8
+ pipeline_tag: sentence-similarity
9
+ tags:
10
+ - sentence-transformers
11
+ - sentence-similarity
12
+ - feature-extraction
13
+ - generated_from_trainer
14
+ - dataset_size:124
15
+ - loss:SoftmaxLoss
16
+ widget:
17
+ - source_sentence: お鍋からの香り
18
+ sentences:
19
+ - お鍋から辛い匂いがしたから
20
+ - 棚からトマトがなくなってたから
21
+ - どっちも要らない
22
+ - source_sentence: 夕飯はチキンヌードルだった?
23
+ sentences:
24
+ - 夕飯は何だったの?
25
+ - 昨日作ったのはチキンヌードル?
26
+ - かみゆ
27
+ - source_sentence: トマトが棚からなくなっていたから
28
+ sentences:
29
+ - なんでしゃべれるの?
30
+ - 夜ご飯を作る前
31
+ - 棚にトマトが見当たらないから
32
+ - source_sentence: スカーフは花壇にある?
33
+ sentences:
34
+ - どのくらいのサイズ?
35
+ - 花壇の中にスカーフはある?
36
+ - 家の中へ行こう
37
+ - source_sentence: 夕飯が辛かったから
38
+ sentences:
39
+ - スカーフはベッドにある?
40
+ - ロウソク
41
+ - 夕飯に辛いスープを飲んだから
42
+ model-index:
43
+ - name: SentenceTransformer based on colorfulscoop/sbert-base-ja
44
+ results:
45
+ - task:
46
+ type: label-accuracy
47
+ name: Label Accuracy
48
+ dataset:
49
+ name: val
50
+ type: val
51
+ metrics:
52
+ - type: accuracy
53
+ value: 1.0
54
+ name: Accuracy
55
+ ---
56
+
57
+ # SentenceTransformer based on colorfulscoop/sbert-base-ja
58
+
59
+ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [colorfulscoop/sbert-base-ja](https://huggingface.co/colorfulscoop/sbert-base-ja). 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.
60
+
61
+ ## Model Details
62
+
63
+ ### Model Description
64
+ - **Model Type:** Sentence Transformer
65
+ - **Base model:** [colorfulscoop/sbert-base-ja](https://huggingface.co/colorfulscoop/sbert-base-ja) <!-- at revision ecb8a98cd5176719ff7ab0d770a27420118732cf -->
66
+ - **Maximum Sequence Length:** 512 tokens
67
+ - **Output Dimensionality:** 768 tokens
68
+ - **Similarity Function:** Cosine Similarity
69
+ <!-- - **Training Dataset:** Unknown -->
70
+ <!-- - **Language:** Unknown -->
71
+ <!-- - **License:** Unknown -->
72
+
73
+ ### Model Sources
74
+
75
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
76
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
77
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
78
+
79
+ ### Full Model Architecture
80
+
81
+ ```
82
+ SentenceTransformer(
83
+ (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel
84
+ (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})
85
+ )
86
+ ```
87
+
88
+ ## Usage
89
+
90
+ ### Direct Usage (Sentence Transformers)
91
+
92
+ First install the Sentence Transformers library:
93
+
94
+ ```bash
95
+ pip install -U sentence-transformers
96
+ ```
97
+
98
+ Then you can load this model and run inference.
99
+ ```python
100
+ from sentence_transformers import SentenceTransformer
101
+
102
+ # Download from the 🤗 Hub
103
+ model = SentenceTransformer("LeoChiuu/sbert-base-ja")
104
+ # Run inference
105
+ sentences = [
106
+ '夕飯が辛かったから',
107
+ '夕飯に辛いスープを飲んだから',
108
+ 'ロウソク',
109
+ ]
110
+ embeddings = model.encode(sentences)
111
+ print(embeddings.shape)
112
+ # [3, 768]
113
+
114
+ # Get the similarity scores for the embeddings
115
+ similarities = model.similarity(embeddings, embeddings)
116
+ print(similarities.shape)
117
+ # [3, 3]
118
+ ```
119
+
120
+ <!--
121
+ ### Direct Usage (Transformers)
122
+
123
+ <details><summary>Click to see the direct usage in Transformers</summary>
124
+
125
+ </details>
126
+ -->
127
+
128
+ <!--
129
+ ### Downstream Usage (Sentence Transformers)
130
+
131
+ You can finetune this model on your own dataset.
132
+
133
+ <details><summary>Click to expand</summary>
134
+
135
+ </details>
136
+ -->
137
+
138
+ <!--
139
+ ### Out-of-Scope Use
140
+
141
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
142
+ -->
143
+
144
+ ## Evaluation
145
+
146
+ ### Metrics
147
+
148
+ #### Label Accuracy
149
+ * Dataset: `val`
150
+ * Evaluated with [<code>LabelAccuracyEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.LabelAccuracyEvaluator)
151
+
152
+ | Metric | Value |
153
+ |:-------------|:--------|
154
+ | **accuracy** | **1.0** |
155
+
156
+ <!--
157
+ ## Bias, Risks and Limitations
158
+
159
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
160
+ -->
161
+
162
+ <!--
163
+ ### Recommendations
164
+
165
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
166
+ -->
167
+
168
+ ## Training Details
169
+
170
+ ### Training Dataset
171
+
172
+ #### Unnamed Dataset
173
+
174
+
175
+ * Size: 124 training samples
176
+ * Columns: <code>sentence_0</code>, <code>sentence_1</code>, and <code>label</code>
177
+ * Approximate statistics based on the first 1000 samples:
178
+ | | sentence_0 | sentence_1 | label |
179
+ |:--------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:-----------------------------|
180
+ | type | string | string | int |
181
+ | details | <ul><li>min: 4 tokens</li><li>mean: 8.59 tokens</li><li>max: 14 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 8.58 tokens</li><li>max: 14 tokens</li></ul> | <ul><li>1: 100.00%</li></ul> |
182
+ * Samples:
183
+ | sentence_0 | sentence_1 | label |
184
+ |:------------------------|:----------------------------|:---------------|
185
+ | <code>どこをさがせばいい?</code> | <code>はじめにどこをさがせばいい?</code> | <code>1</code> |
186
+ | <code>昨日なに作ったの?</code> | <code>ゆうべはなにをたべたの?</code> | <code>1</code> |
187
+ | <code>井戸</code> | <code>井戸を調べよう</code> | <code>1</code> |
188
+ * Loss: [<code>SoftmaxLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#softmaxloss)
189
+
190
+ ### Training Hyperparameters
191
+ #### Non-Default Hyperparameters
192
+
193
+ - `eval_strategy`: steps
194
+ - `per_device_train_batch_size`: 1
195
+ - `per_device_eval_batch_size`: 1
196
+ - `num_train_epochs`: 1
197
+ - `multi_dataset_batch_sampler`: round_robin
198
+
199
+ #### All Hyperparameters
200
+ <details><summary>Click to expand</summary>
201
+
202
+ - `overwrite_output_dir`: False
203
+ - `do_predict`: False
204
+ - `eval_strategy`: steps
205
+ - `prediction_loss_only`: True
206
+ - `per_device_train_batch_size`: 1
207
+ - `per_device_eval_batch_size`: 1
208
+ - `per_gpu_train_batch_size`: None
209
+ - `per_gpu_eval_batch_size`: None
210
+ - `gradient_accumulation_steps`: 1
211
+ - `eval_accumulation_steps`: None
212
+ - `torch_empty_cache_steps`: None
213
+ - `learning_rate`: 5e-05
214
+ - `weight_decay`: 0.0
215
+ - `adam_beta1`: 0.9
216
+ - `adam_beta2`: 0.999
217
+ - `adam_epsilon`: 1e-08
218
+ - `max_grad_norm`: 1
219
+ - `num_train_epochs`: 1
220
+ - `max_steps`: -1
221
+ - `lr_scheduler_type`: linear
222
+ - `lr_scheduler_kwargs`: {}
223
+ - `warmup_ratio`: 0.0
224
+ - `warmup_steps`: 0
225
+ - `log_level`: passive
226
+ - `log_level_replica`: warning
227
+ - `log_on_each_node`: True
228
+ - `logging_nan_inf_filter`: True
229
+ - `save_safetensors`: True
230
+ - `save_on_each_node`: False
231
+ - `save_only_model`: False
232
+ - `restore_callback_states_from_checkpoint`: False
233
+ - `no_cuda`: False
234
+ - `use_cpu`: False
235
+ - `use_mps_device`: False
236
+ - `seed`: 42
237
+ - `data_seed`: None
238
+ - `jit_mode_eval`: False
239
+ - `use_ipex`: False
240
+ - `bf16`: False
241
+ - `fp16`: False
242
+ - `fp16_opt_level`: O1
243
+ - `half_precision_backend`: auto
244
+ - `bf16_full_eval`: False
245
+ - `fp16_full_eval`: False
246
+ - `tf32`: None
247
+ - `local_rank`: 0
248
+ - `ddp_backend`: None
249
+ - `tpu_num_cores`: None
250
+ - `tpu_metrics_debug`: False
251
+ - `debug`: []
252
+ - `dataloader_drop_last`: False
253
+ - `dataloader_num_workers`: 0
254
+ - `dataloader_prefetch_factor`: None
255
+ - `past_index`: -1
256
+ - `disable_tqdm`: False
257
+ - `remove_unused_columns`: True
258
+ - `label_names`: None
259
+ - `load_best_model_at_end`: False
260
+ - `ignore_data_skip`: False
261
+ - `fsdp`: []
262
+ - `fsdp_min_num_params`: 0
263
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
264
+ - `fsdp_transformer_layer_cls_to_wrap`: None
265
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
266
+ - `deepspeed`: None
267
+ - `label_smoothing_factor`: 0.0
268
+ - `optim`: adamw_torch
269
+ - `optim_args`: None
270
+ - `adafactor`: False
271
+ - `group_by_length`: False
272
+ - `length_column_name`: length
273
+ - `ddp_find_unused_parameters`: None
274
+ - `ddp_bucket_cap_mb`: None
275
+ - `ddp_broadcast_buffers`: False
276
+ - `dataloader_pin_memory`: True
277
+ - `dataloader_persistent_workers`: False
278
+ - `skip_memory_metrics`: True
279
+ - `use_legacy_prediction_loop`: False
280
+ - `push_to_hub`: False
281
+ - `resume_from_checkpoint`: None
282
+ - `hub_model_id`: None
283
+ - `hub_strategy`: every_save
284
+ - `hub_private_repo`: False
285
+ - `hub_always_push`: False
286
+ - `gradient_checkpointing`: False
287
+ - `gradient_checkpointing_kwargs`: None
288
+ - `include_inputs_for_metrics`: False
289
+ - `eval_do_concat_batches`: True
290
+ - `fp16_backend`: auto
291
+ - `push_to_hub_model_id`: None
292
+ - `push_to_hub_organization`: None
293
+ - `mp_parameters`:
294
+ - `auto_find_batch_size`: False
295
+ - `full_determinism`: False
296
+ - `torchdynamo`: None
297
+ - `ray_scope`: last
298
+ - `ddp_timeout`: 1800
299
+ - `torch_compile`: False
300
+ - `torch_compile_backend`: None
301
+ - `torch_compile_mode`: None
302
+ - `dispatch_batches`: None
303
+ - `split_batches`: None
304
+ - `include_tokens_per_second`: False
305
+ - `include_num_input_tokens_seen`: False
306
+ - `neftune_noise_alpha`: None
307
+ - `optim_target_modules`: None
308
+ - `batch_eval_metrics`: False
309
+ - `eval_on_start`: False
310
+ - `eval_use_gather_object`: False
311
+ - `batch_sampler`: batch_sampler
312
+ - `multi_dataset_batch_sampler`: round_robin
313
+
314
+ </details>
315
+
316
+ ### Training Logs
317
+ | Epoch | Step | val_accuracy |
318
+ |:------:|:----:|:------------:|
319
+ | 0.4032 | 50 | 1.0 |
320
+ | 0.8065 | 100 | 1.0 |
321
+ | 1.0 | 124 | 1.0 |
322
+
323
+
324
+ ### Framework Versions
325
+ - Python: 3.11.9
326
+ - Sentence Transformers: 3.0.1
327
+ - Transformers: 4.44.1
328
+ - PyTorch: 2.3.0+cpu
329
+ - Accelerate: 0.32.1
330
+ - Datasets: 2.19.1
331
+ - Tokenizers: 0.19.1
332
+
333
+ ## Citation
334
+
335
+ ### BibTeX
336
+
337
+ #### Sentence Transformers and SoftmaxLoss
338
+ ```bibtex
339
+ @inproceedings{reimers-2019-sentence-bert,
340
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
341
+ author = "Reimers, Nils and Gurevych, Iryna",
342
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
343
+ month = "11",
344
+ year = "2019",
345
+ publisher = "Association for Computational Linguistics",
346
+ url = "https://arxiv.org/abs/1908.10084",
347
+ }
348
+ ```
349
+
350
+ <!--
351
+ ## Glossary
352
+
353
+ *Clearly define terms in order to be accessible across audiences.*
354
+ -->
355
+
356
+ <!--
357
+ ## Model Card Authors
358
+
359
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
360
+ -->
361
+
362
+ <!--
363
+ ## Model Card Contact
364
+
365
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
366
+ -->
added_tokens.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "[PAD]": 32000
3
+ }
config.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "colorfulscoop/sbert-base-ja",
3
+ "architectures": [
4
+ "BertModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 2,
8
+ "classifier_dropout": null,
9
+ "cls_token_id": 2,
10
+ "eos_token_id": 3,
11
+ "gradient_checkpointing": false,
12
+ "hidden_act": "gelu",
13
+ "hidden_dropout_prob": 0.1,
14
+ "hidden_size": 768,
15
+ "initializer_range": 0.02,
16
+ "intermediate_size": 3072,
17
+ "layer_norm_eps": 1e-12,
18
+ "mask_token_id": 4,
19
+ "max_position_embeddings": 512,
20
+ "model_type": "bert",
21
+ "num_attention_heads": 12,
22
+ "num_hidden_layers": 12,
23
+ "pad_token_id": 0,
24
+ "position_embedding_type": "absolute",
25
+ "sep_token_id": 3,
26
+ "tokenizer_class": "DebertaV2Tokenizer",
27
+ "torch_dtype": "float32",
28
+ "transformers_version": "4.44.1",
29
+ "type_vocab_size": 2,
30
+ "unk_token_id": 1,
31
+ "use_cache": true,
32
+ "vocab_size": 32000
33
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "3.0.1",
4
+ "transformers": "4.44.1",
5
+ "pytorch": "2.3.0+cpu"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": null
10
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b907111df57dab8d76edcab0e171586fd89cd4434dba43a85ed8a82fb3692027
3
+ size 442491744
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": 512,
3
+ "do_lower_case": false
4
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "[CLS]",
3
+ "cls_token": "[CLS]",
4
+ "eos_token": "[SEP]",
5
+ "mask_token": "[MASK]",
6
+ "pad_token": "<pad>",
7
+ "sep_token": "[SEP]",
8
+ "unk_token": {
9
+ "content": "<unk>",
10
+ "lstrip": false,
11
+ "normalized": true,
12
+ "rstrip": false,
13
+ "single_word": false
14
+ }
15
+ }
spm.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d6467857b4b0c77ded9bac7ad2fb5c16eb64e17e417ce46624dacac2bbb404fc
3
+ size 802713
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "1": {
12
+ "content": "<unk>",
13
+ "lstrip": false,
14
+ "normalized": true,
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": false
26
+ },
27
+ "3": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": false
34
+ },
35
+ "4": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": false
42
+ },
43
+ "32000": {
44
+ "content": "[PAD]",
45
+ "lstrip": false,
46
+ "normalized": true,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": false
50
+ }
51
+ },
52
+ "bos_token": "[CLS]",
53
+ "clean_up_tokenization_spaces": true,
54
+ "cls_token": "[CLS]",
55
+ "do_lower_case": false,
56
+ "eos_token": "[SEP]",
57
+ "mask_token": "[MASK]",
58
+ "model_max_length": 512,
59
+ "pad_token": "<pad>",
60
+ "sep_token": "[SEP]",
61
+ "sp_model_kwargs": {},
62
+ "split_by_punct": false,
63
+ "tokenizer_class": "DebertaV2Tokenizer",
64
+ "unk_token": "<unk>"
65
+ }