Views
No views yet

SentenceTransformer(
(0): Transformer({'max_seq_length': 8192, 'do_lower_case': False, 'architecture': 'LlamaModel'})
(1): Pooling({'word_embedding_dimension': 1792, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': True, 'include_prompt': False})
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("kushalc1/sarashina-embedding-v2-1b-jsts-matryoshka")
5# Run inference
6sentences = [
7 '樹木に囲まれた芝生の上に三頭のキリンが立っています。',
8 '芝生の上に数頭のキリンが歩いています。',
9 '茶色のテーブルの上にピザと飲み物が置かれています。',
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 1792]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities)
18# tensor([[1.0000, 0.9453, 0.4754],
19# [0.9453, 1.0000, 0.5004],
20# [0.4754, 0.5004, 1.0000]])sts-dev-1792, sts-test-1792 and sts-test-1792EmbeddingSimilarityEvaluator with these parameters:
1{
2 "truncate_dim": 1792
3}| Metric | sts-dev-1792 | sts-test-1792 |
|---|---|---|
| pearson_cosine | 0.8088 | 0.8088 |
| spearman_cosine | 0.7435 | 0.7435 |
sts-dev-1280, sts-test-1280 and sts-test-1280EmbeddingSimilarityEvaluator with these parameters:
1{
2 "truncate_dim": 1280
3}| Metric | sts-dev-1280 | sts-test-1280 |
|---|---|---|
| pearson_cosine | 0.8078 | 0.8078 |
| spearman_cosine | 0.7442 | 0.7442 |
sts-dev-768, sts-test-768 and sts-test-768EmbeddingSimilarityEvaluator with these parameters:
1{
2 "truncate_dim": 768
3}| Metric | sts-dev-768 | sts-test-768 |
|---|---|---|
| pearson_cosine | 0.8049 | 0.8049 |
| spearman_cosine | 0.7423 | 0.7423 |
sts-dev-256, sts-test-256 and sts-test-256EmbeddingSimilarityEvaluator with these parameters:
1{
2 "truncate_dim": 256
3}| Metric | sts-dev-256 | sts-test-256 |
|---|---|---|
| pearson_cosine | 0.8022 | 0.8022 |
| spearman_cosine | 0.7411 | 0.7411 |
sts-dev-64, sts-test-64 and sts-test-64EmbeddingSimilarityEvaluator with these parameters:
1{
2 "truncate_dim": 64
3}| Metric | sts-dev-64 | sts-test-64 |
|---|---|---|
| pearson_cosine | 0.7972 | 0.7972 |
| spearman_cosine | 0.7389 | 0.7389 |
sentence1, sentence2, and score| sentence1 | sentence2 | score | |
|---|---|---|---|
| type | string | string | float |
| details |
|
|
|
| sentence1 | sentence2 | score |
|---|---|---|
川べりでサーフボードを持った人たちがいます。 | トイレの壁に黒いタオルがかけられています。 | 0.0 |
二人の男性がジャンボジェット機を見ています。 | 2人の男性が、白い飛行機を眺めています。 | 3.799999952316284 |
男性が子供を抱き上げて立っています。 | 坊主頭の男性が子供を抱いて立っています。 | 4.0 |
MatryoshkaLoss with these parameters:
1{
2 "loss": "MultipleNegativesRankingLoss",
3 "matryoshka_dims": [
4 1792,
5 1280,
6 768,
7 256,
8 64
9 ],
10 "matryoshka_weights": [
11 1,
12 1,
13 1,
14 1,
15 1
16 ],
17 "n_dims_per_step": -1
18}sentence1, sentence2, and score| sentence1 | sentence2 | score | |
|---|---|---|---|
| type | string | string | float |
| details |
|
|
|
| sentence1 | sentence2 | score |
|---|---|---|
レンガの建物の前を、乳母車を押した女性が歩いています。 | 厩舎で馬と女性とが寄り添っています。 | 0.0 |
山の上に顔の白い牛が2頭います。 | 曇り空の山肌で、牛が2匹草を食んでいます。 | 2.4000000953674316 |
バナナを持った人が道路を通行しています。 | 道の上をバナナを背負った男性が歩いています。 | 3.5999999046325684 |
MatryoshkaLoss with these parameters:
1{
2 "loss": "MultipleNegativesRankingLoss",
3 "matryoshka_dims": [
4 1792,
5 1280,
6 768,
7 256,
8 64
9 ],
10 "matryoshka_weights": [
11 1,
12 1,
13 1,
14 1,
15 1
16 ],
17 "n_dims_per_step": -1
18}eval_strategy: stepsper_device_train_batch_size: 16per_device_eval_batch_size: 16num_train_epochs: 4warmup_ratio: 0.1fp16: Trueoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 16per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 4max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.1warmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Truesave_safetensors: Truesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseno_cuda: Falseuse_cpu: Falseuse_mps_device: Falseseed: 42data_seed: Nonejit_mode_eval: Falseuse_ipex: Falsebf16: Falsefp16: Truefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: 0ddp_backend: Nonetpu_num_cores: Nonetpu_metrics_debug: Falsedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Trueuse_legacy_prediction_loop: Falsepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_do_concat_batches: Truefp16_backend: autopush_to_hub_model_id: Nonepush_to_hub_organization: Nonemp_parameters:auto_find_batch_size: Falsefull_determinism: Falsetorchdynamo: Noneray_scope: lastddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss | Validation Loss | sts-dev-1792_spearman_cosine | sts-dev-1280_spearman_cosine | sts-dev-768_spearman_cosine | sts-dev-256_spearman_cosine | sts-dev-64_spearman_cosine | sts-test-1792_spearman_cosine | sts-test-1280_spearman_cosine | sts-test-768_spearman_cosine | sts-test-256_spearman_cosine | sts-test-64_spearman_cosine |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0.1284 | 100 | 4.911 | 6.2373 | 0.7573 | 0.7572 | 0.7517 | 0.7350 | 0.7114 | - | - | - | - | - |
| 0.2567 | 200 | 5.8664 | 7.9813 | 0.6739 | 0.6692 | 0.6636 | 0.6500 | 0.6146 | - | - | - | - | - |
| 0.3851 | 300 | 7.259 | 7.9829 | 0.6831 | 0.6815 | 0.6797 | 0.6698 | 0.6529 | - | - | - | - | - |
| 0.5135 | 400 | 7.1234 | 7.5810 | 0.6878 | 0.6887 | 0.6881 | 0.6819 | 0.6679 | - | - | - | - | - |
| 0.6418 | 500 | 7.233 | 6.9384 | 0.6628 | 0.6694 | 0.6658 | 0.6662 | 0.6583 | - | - | - | - | - |
| 0.7702 | 600 | 7.0228 | 7.0102 | 0.6352 | 0.6364 | 0.6346 | 0.6310 | 0.6246 | - | - | - | - | - |
| 0.8986 | 700 | 6.539 | 6.7671 | 0.6411 | 0.6415 | 0.6403 | 0.6394 | 0.6346 | - | - | - | - | - |
| 1.0270 | 800 | 6.2863 | 7.5846 | 0.6120 | 0.6342 | 0.6314 | 0.6266 | 0.6189 | - | - | - | - | - |
| 1.1553 | 900 | 5.7608 | 6.7480 | 0.6773 | 0.6790 | 0.6758 | 0.6748 | 0.6691 | - | - | - | - | - |
| 1.2837 | 1000 | 5.672 | 6.6481 | 0.6846 | 0.6836 | 0.6817 | 0.6834 | 0.6794 | - | - | - | - | - |
| 1.4121 | 1100 | 5.7371 | 6.6843 | 0.6945 | 0.6953 | 0.6966 | 0.6939 | 0.6891 | - | - | - | - | - |
| 1.5404 | 1200 | 5.8827 | 6.6863 | 0.6903 | 0.6940 | 0.6922 | 0.6883 | 0.6834 | - | - | - | - | - |
| 1.6688 | 1300 | 5.6242 | 6.6517 | 0.6856 | 0.6857 | 0.6847 | 0.6809 | 0.6762 | - | - | - | - | - |
| 1.7972 | 1400 | 5.5211 | 6.1428 | 0.7134 | 0.7123 | 0.7117 | 0.7065 | 0.7022 | - | - | - | - | - |
| 1.9255 | 1500 | 5.4882 | 6.0439 | 0.7227 | 0.7227 | 0.7214 | 0.7192 | 0.7134 | - | - | - | - | - |
| 2.0539 | 1600 | 5.4436 | 6.0361 | 0.7199 | 0.7203 | 0.7191 | 0.7201 | 0.7143 | - | - | - | - | - |
| 2.1823 | 1700 | 4.366 | 6.1447 | 0.7286 | 0.7290 | 0.7274 | 0.7283 | 0.7231 | - | - | - | - | - |
| 2.3107 | 1800 | 4.6607 | 6.1692 | 0.7365 | 0.7356 | 0.7344 | 0.7303 | 0.7263 | - | - | - | - | - |
| 2.4390 | 1900 | 4.3651 | 6.2109 | 0.7178 | 0.7169 | 0.7149 | 0.7134 | 0.7125 | - | - | - | - | - |
| 2.5674 | 2000 | 4.4692 | 6.1421 | 0.7237 | 0.7233 | 0.7214 | 0.7192 | 0.7150 | - | - | - | - | - |
| 2.6958 | 2100 | 4.434 | 5.9462 | 0.7275 | 0.7267 | 0.7260 | 0.7253 | 0.7203 | - | - | - | - | - |
| 2.8241 | 2200 | 4.2634 | 6.0055 | 0.7218 | 0.7216 | 0.7205 | 0.7196 | 0.7177 | - | - | - | - | - |
| 2.9525 | 2300 | 4.2524 | 5.8834 | 0.7297 | 0.7308 | 0.7302 | 0.7282 | 0.7245 | - | - | - | - | - |
| 3.0809 | 2400 | 3.5146 | 6.2635 | 0.7430 | 0.7425 | 0.7416 | 0.7402 | 0.7357 | - | - | - | - | - |
| 3.2092 | 2500 | 3.0137 | 6.1396 | 0.7455 | 0.7441 | 0.7430 | 0.7410 | 0.7377 | - | - | - | - | - |
| 3.3376 | 2600 | 2.9956 | 6.2779 | 0.7426 | 0.7427 | 0.7407 | 0.7402 | 0.7371 | - | - | - | - | - |
| 3.4660 | 2700 | 3.0125 | 6.2415 | 0.7459 | 0.7457 | 0.7435 | 0.7425 | 0.7378 | - | - | - | - | - |
| 3.5944 | 2800 | 3.2683 | 6.2214 | 0.7407 | 0.7407 | 0.7385 | 0.7378 | 0.7342 | - | - | - | - | - |
| 3.7227 | 2900 | 2.7818 | 6.2854 | 0.7444 | 0.7442 | 0.7422 | 0.7411 | 0.7390 | - | - | - | - | - |
| 3.8511 | 3000 | 2.7216 | 6.2760 | 0.7425 | 0.7429 | 0.7411 | 0.7401 | 0.7378 | - | - | - | - | - |
| 3.9795 | 3100 | 2.8901 | 6.2306 | 0.7435 | 0.7442 | 0.7423 | 0.7411 | 0.7389 | - | - | - | - | - |
| -1 | -1 | - | - | - | - | - | - | - | 0.7435 | 0.7442 | 0.7423 | 0.7411 | 0.7389 |
1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}1@misc{kusupati2024matryoshka,
2 title={Matryoshka Representation Learning},
3 author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
4 year={2024},
5 eprint={2205.13147},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG}
8}1@misc{henderson2017efficient,
2 title={Efficient Natural Language Response Suggestion for Smart Reply},
3 author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
4 year={2017},
5 eprint={1705.00652},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}