CoolFace
Modelpublic

Solomennikova/labse_funetuned_for_categories

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes13downloads
Model Card

SentenceTransformer based on cointegrated/LaBSE-en-ru

This is a sentence-transformers model finetuned from cointegrated/LaBSE-en-ru. 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.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: cointegrated/LaBSE-en-ru <!-- at revision cf0714e606d4af551e14ad69a7929cd6b0da7f7e -->
  • Maximum Sequence Length: 512 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel 
  (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, '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': False, 'include_prompt': True})
  (2): Dense({'in_features': 768, 'out_features': 768, 'bias': True, 'activation_function': 'torch.nn.modules.activation.Tanh'})
  (3): Normalize()
)

Usage

Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

bash
pip install -U sentence-transformers

Then you can load this model and run inference.

python
from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("Solomennikova/labse_funetuned_for_categories")
# Run inference
sentences = [
    'набор мебель для прихожая',
    'Тумбы для обуви',
    'Туалетные столики',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]

<!--

Direct Usage (Transformers)

<details><summary>Click to see the direct usage in Transformers</summary>

</details> -->

<!--

Downstream Usage (Sentence Transformers)

You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

</details> -->

<!--

Out-of-Scope Use

List how the model may foreseeably be misused and address what users ought not to do with the model. -->

<!--

Bias, Risks and Limitations

What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model. -->

<!--

Recommendations

What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->

Training Details

Training Dataset

Unnamed Dataset
  • Size: 164,318 training samples
  • Columns: <code>sentence0</code> and <code>sentence1</code>
  • Approximate statistics based on the first 1000 samples: | | sentence0 | sentence1 | |:--------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 3 tokens</li><li>mean: 5.77 tokens</li><li>max: 17 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 6.82 tokens</li><li>max: 14 tokens</li></ul> |
  • Samples: | sentence0 | sentence1 | |:---------------------------------|:------------------------------------| | <code>матрасный основание</code> | <code>Основания для кроватей</code> | | <code>простыня сатина</code> | <code>Наволочки</code> | | <code>costa</code> | <code>Тумбы</code> |
  • Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }

Training Hyperparameters

Non-Default Hyperparameters
  • per_device_train_batch_size: 64
  • per_device_eval_batch_size: 64
  • num_train_epochs: 50
  • multi_dataset_batch_sampler: round_robin
All Hyperparameters

<details><summary>Click to expand</summary>

  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: no
  • prediction_loss_only: True
  • per_device_train_batch_size: 64
  • per_device_eval_batch_size: 64
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 5e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1
  • num_train_epochs: 50
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.0
  • warmup_steps: 0
  • log_level: passive
  • log_level_replica: warning
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • save_safetensors: True
  • save_on_each_node: False
  • save_only_model: False
  • restore_callback_states_from_checkpoint: False
  • no_cuda: False
  • use_cpu: False
  • use_mps_device: False
  • seed: 42
  • data_seed: None
  • jit_mode_eval: False
  • use_ipex: False
  • bf16: False
  • fp16: False
  • fp16_opt_level: O1
  • half_precision_backend: auto
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • local_rank: 0
  • ddp_backend: None
  • tpu_num_cores: None
  • tpu_metrics_debug: False
  • debug: []
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_prefetch_factor: None
  • past_index: -1
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: False
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_min_num_params: 0
  • fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • skip_memory_metrics: True
  • use_legacy_prediction_loop: False
  • push_to_hub: False
  • resume_from_checkpoint: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_private_repo: None
  • hub_always_push: False
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • include_for_metrics: []
  • eval_do_concat_batches: True
  • fp16_backend: auto
  • push_to_hub_model_id: None
  • push_to_hub_organization: None
  • mp_parameters:
  • auto_find_batch_size: False
  • full_determinism: False
  • torchdynamo: None
  • ray_scope: last
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • dispatch_batches: None
  • split_batches: None
  • include_tokens_per_second: False
  • include_num_input_tokens_seen: False
  • neftune_noise_alpha: None
  • optim_target_modules: None
  • batch_eval_metrics: False
  • eval_on_start: False
  • use_liger_kernel: False
  • eval_use_gather_object: False
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: round_robin

</details>

Training Logs

<details><summary>Click to expand</summary>

EpochStepTraining Loss
0.19475004.5321
0.389410003.8501
0.584115003.6982
0.778820003.5882
0.973525003.5182
1.168230003.4484
1.362935003.4114
1.557640003.3743
1.752345003.3427
1.947050003.3218
2.141755003.2676
2.336460003.2554
2.531265003.2181
2.725970003.2045
2.920675003.1862
3.115380003.1527
3.310085003.0955
3.504790003.0996
3.699495003.0927
3.8941100003.0835
4.0888105003.0255
4.2835110002.9838
4.4782115002.9863
4.6729120002.9808
4.8676125002.9844
5.0623130002.9292
5.2570135002.8713
5.4517140002.8853
5.6464145002.8795
5.8411150002.8686
6.0358155002.8367
6.2305160002.7667
6.4252165002.7688
6.6199170002.7618
6.8146175002.7709
7.0093180002.7628
7.2040185002.6531
7.3988190002.6788
7.5935195002.6685
7.7882200002.7033
7.9829205002.6823
8.1776210002.5856
8.3723215002.5718
8.5670220002.616
8.7617225002.6025
8.9564230002.6056
9.1511235002.5101
9.3458240002.5131
9.5405245002.5113
9.7352250002.5394
9.9299255002.5543
10.1246260002.4642
10.3193265002.4361
10.5140270002.4512
10.7087275002.4664
10.9034280002.475
11.0981285002.4116
11.2928290002.367
11.4875295002.3674
11.6822300002.4078
11.8769305002.4239
12.0717310002.3825
12.2664315002.3082
12.4611320002.3397
12.6558325002.3281
12.8505330002.3602
13.0452335002.3268
13.2399340002.2552
13.4346345002.2549
13.6293350002.2813
13.8240355002.3085
14.0187360002.2883
14.2134365002.2031
14.4081370002.2178
14.6028375002.2312
14.7975380002.2357
14.9922385002.2585
15.1869390002.1408
15.3816395002.1626
15.5763400002.1845
15.7710405002.2172
15.9657410002.2133
16.1604415002.1009
16.3551420002.1331
16.5498425002.1417
16.7445430002.1469
16.9393435002.1676
17.1340440002.0622
17.3287445002.0603
17.5234450002.0909
17.7181455002.1163
17.9128460002.131
18.1075465002.059
18.3022470002.024
18.4969475002.0563
18.6916480002.0669
18.8863485002.087
19.0810490002.0452
19.2757495001.9731
19.4704500002.0031
19.6651505002.0318
19.8598510002.0514
20.0545515002.0381
20.2492520001.9449
20.4439525001.9689
20.6386530001.9848
20.8333535002.0179
21.0280540001.9892
21.2227545001.8909
21.4174550001.942
21.6121555001.9603
21.8069560001.9785
22.0016565002.0078
22.1963570001.882
22.3910575001.9084
22.5857580001.9256
22.7804585001.9274
22.9751590001.9576
23.1698595001.8427
23.3645600001.8742
23.5592605001.894
23.7539610001.9073
23.9486615001.9407
24.1433620001.8524
24.3380625001.8412
24.5327630001.8768
24.7274635001.8663
24.9221640001.9083
25.1168645001.8294
25.3115650001.8095
25.5062655001.8445
25.7009660001.8411
25.8956665001.8734
26.0903670001.8253
26.2850675001.782
26.4798680001.8062
26.6745685001.8333
26.8692690001.8488
27.0639695001.8223
27.2586700001.7619
27.4533705001.7874
27.6480710001.8049
27.8427715001.8165
28.0374720001.8073
28.2321725001.735
28.4268730001.7548
28.6215735001.7831
28.8162740001.7963
29.0109745001.8057
29.2056750001.7101
29.4003755001.7343
29.5950760001.7544
29.7897765001.7583
29.9844770001.8093
30.1791775001.6939
30.3738780001.7245
30.5685785001.7235
30.7632790001.7489
30.9579795001.7696
31.1526800001.7008
31.3474805001.6873
31.5421810001.7093
31.7368815001.7317
31.9315820001.7503
32.1262825001.6979
32.3209830001.6945
32.5156835001.6963
32.7103840001.7047
32.9050845001.7119
33.0997850001.6779
33.2944855001.6628
33.4891860001.6773
33.6838865001.6851
33.8785870001.7201
34.0732875001.6765
34.2679880001.6453
34.4626885001.6501
34.6573890001.665
34.8520895001.7058
35.0467900001.6666
35.2414905001.6337
35.4361910001.6371
35.6308915001.6644
35.8255920001.6585
36.0202925001.6702
36.2150930001.615
36.4097935001.6217
36.6044940001.6447
36.7991945001.6542
36.9938950001.6621
37.1885955001.602
37.3832960001.615
37.5779965001.6211
37.7726970001.6405
37.9673975001.6465
38.1620980001.596
38.3567985001.5918
38.5514990001.6215
38.7461995001.6223
38.94081000001.619
39.13551005001.6038
39.33021010001.5901
39.52491015001.5883
39.71961020001.6072
39.91431025001.6249
40.10901030001.5904
40.30371035001.5753
40.49841040001.5932
40.69311045001.5997
40.88791050001.5997
41.08261055001.5821
41.27731060001.5626
41.47201065001.5698
41.66671070001.5781
41.86141075001.5862
42.05611080001.5791
42.25081085001.5514
42.44551090001.565
42.64021095001.5763
42.83491100001.5841
43.02961105001.574
43.22431110001.5506
43.41901115001.5595
43.61371120001.5541
43.80841125001.5591
44.00311130001.5731
44.19781135001.5371
44.39251140001.5544
44.58721145001.5474
44.78191150001.5525
44.97661155001.5662
45.17131160001.5315
45.36601165001.5306
45.56071170001.5329
45.75551175001.5393
45.95021180001.5575
46.14491185001.5309
46.33961190001.5162
46.53431195001.536
46.72901200001.5325
46.92371205001.5441
47.11841210001.5203
47.31311215001.5223
47.50781220001.5289
47.70251225001.5294
47.89721230001.5277
48.09191235001.5243
48.28661240001.5164
48.48131245001.5233
48.67601250001.5129
48.87071255001.5154
49.06541260001.5148
49.26011265001.5144
49.45481270001.4996
49.64951275001.51
49.84421280001.5164

</details>

Framework Versions

  • Python: 3.10.12
  • Sentence Transformers: 4.0.1
  • Transformers: 4.48.3
  • PyTorch: 2.6.0+cu124
  • Accelerate: 1.5.2
  • Datasets: 3.4.1
  • Tokenizers: 0.21.1

Citation

BibTeX

Sentence Transformers
bibtex
@inproceedings{reimers-2019-sentence-bert,
    title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
    author = "Reimers, Nils and Gurevych, Iryna",
    booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
    month = "11",
    year = "2019",
    publisher = "Association for Computational Linguistics",
    url = "https://arxiv.org/abs/1908.10084",
}
MultipleNegativesRankingLoss
bibtex
@misc{henderson2017efficient,
    title={Efficient Natural Language Response Suggestion for Smart Reply},
    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},
    year={2017},
    eprint={1705.00652},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}

<!--

Glossary

Clearly define terms in order to be accessible across audiences. -->

<!--

Model Card Authors

Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction. -->

<!--

Model Card Contact

Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors. -->