Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 19
How to use Severino2004/cv-ai-embedding-model-severino2004 with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("Severino2004/cv-ai-embedding-model-severino2004")
sentences = [
"Larissa Yamada — Agent·e Immobilier·ère — Toronto\nBTS Professions Immobilières | 6 ans d'expérience\nExpérience : Estimation et mise en vente de biens immobiliers\nCompétences : négociation, droit immobilier, relation client, prospection",
"Notre organisation est à la recherche d'un·e Commercial·e motivé·e.\n\nMissions :\n- Reporter l'activité commerciale via le CRM\n- Négocier les contrats commerciaux\n- Prospecter de nouveaux comptes\n\nProfil recherché :\n- CRM\n- négociation\n- objectifs de vente",
"Dans le cadre de notre développement, nous recrutons un·e Enseignant·e / Formateur·rice.\n\nMissions :\n- Préparer et animer des séances pédagogiques\n- Assurer le suivi individualisé des apprenants\n\nProfil recherché :\n- préparation de cours\n- pédagogie\n- évaluation",
"Notre organisation est à la recherche d'un·e Responsable Qualité motivé·e.\n\nMissions :\n- Animer l'amélioration continue\n- Réaliser des audits internes\n\nProfil recherché :\n- gestion des non-conformités\n- documentation qualité\n- amélioration continue\n- audit qualité"
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]This is a sentence-transformers model finetuned from sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2. It maps inputs to a 384-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, classification, clustering, and more.
SentenceTransformer(
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'BertModel'})
(1): Pooling({'embedding_dimension': 384, 'pooling_mode': 'mean', 'include_prompt': True})
)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("Severino2004/cv-ai-embedding-model-severino2004")
# Run inference
sentences = [
'Anya Fernández\nChargé·e de Projet\nTokyo\n\nFORMATION\nMaster en Management de Projet\n\nEXPÉRIENCE PROFESSIONNELLE (5 ans)\n- Identification et suivi des risques projet\n\nCOMPÉTENCES\nbudget, reporting, gestion des risques, Scrum',
"Dans le cadre de notre développement, nous recrutons un·e Comptable.\n\nMissions :\n- Préparer les clôtures mensuelles et annuelles\n- Participer à l'élaboration du budget prévisionnel\n\nProfil recherché :\n- déclarations TVA\n- comptabilité générale\n- Excel avancé\n- SAGE\n- clôtures comptables",
"Dans le cadre de notre développement, nous recrutons un·e Chargé·e de Projet.\n\nMissions :\n- Rendre compte de l'avancement à la direction\n- Élaborer et suivre le planning et le budget des projets\n\nProfil recherché :\n- Scrum\n- budget\n- planning\n- gestion des risques",
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.4949, 0.9233],
# [0.4949, 1.0000, 0.5280],
# [0.9233, 0.5280, 1.0000]])
sentence1, sentence2, and score| sentence1 | sentence2 | score | |
|---|---|---|---|
| type | string | string | float |
| modality | text | text | |
| details |
|
|
|
| sentence1 | sentence2 | score |
|---|---|---|
Maya Garcia |
Pour renforcer notre équipe, nous ouvrons un poste de Conducteur·rice de Travaux. |
0.5 |
Kwame Popescu |
À PROPOS DE NOUS |
0.5 |
Haruto Novak |
Pour renforcer notre équipe, nous ouvrons un poste de Ingénieur·e Environnement. |
1.0 |
CosineSimilarityLoss with these parameters:{
"loss_fct": "torch.nn.modules.loss.MSELoss",
"cos_score_transformation": "torch.nn.modules.linear.Identity"
}
sentence1, sentence2, and score| sentence1 | sentence2 | score | |
|---|---|---|---|
| type | string | string | float |
| modality | text | text | |
| details |
|
|
|
| sentence1 | sentence2 | score |
|---|---|---|
Ravi Larsen |
Nous recherchons un·e Chef·fe de Cuisine pour rejoindre notre équipe. |
1.0 |
Diego Kim |
QUI SOMMES-NOUS |
0.0 |
Mei-ling Kowalski |
Dans le cadre de notre développement, nous recrutons un·e Chargé·e de Projet. |
0.0 |
CosineSimilarityLoss with these parameters:{
"loss_fct": "torch.nn.modules.loss.MSELoss",
"cos_score_transformation": "torch.nn.modules.linear.Identity"
}
num_train_epochs: 5warmup_steps: 20per_device_train_batch_size: 8num_train_epochs: 5max_steps: -1learning_rate: 5e-05lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_steps: 20optim: adamw_torch_fusedoptim_args: Noneweight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08optim_target_modules: Nonegradient_accumulation_steps: 1average_tokens_across_devices: Truemax_grad_norm: 1.0label_smoothing_factor: 0.0bf16: Falsefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Nonetorch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneuse_liger_kernel: Falseliger_kernel_config: Noneuse_cache: Falseneftune_noise_alpha: Nonetorch_empty_cache_steps: Noneauto_find_batch_size: Falselog_on_each_node: Truelogging_nan_inf_filter: Trueinclude_num_input_tokens_seen: nolog_level: passivelog_level_replica: warningdisable_tqdm: Falseproject: huggingfacetrackio_space_id: Nonetrackio_bucket_id: Nonetrackio_static_space_id: Noneper_device_eval_batch_size: 8prediction_loss_only: Trueeval_on_start: Falseeval_do_concat_batches: Trueeval_use_gather_object: Falseeval_accumulation_steps: Noneinclude_for_metrics: []batch_eval_metrics: Falsesave_only_model: Falsesave_on_each_node: Falseenable_jit_checkpoint: Falsepush_to_hub: Falsehub_private_repo: Nonehub_model_id: Nonehub_strategy: every_savehub_always_push: Falsehub_revision: Noneload_best_model_at_end: Falseignore_data_skip: Falserestore_callback_states_from_checkpoint: Falsefull_determinism: Falseseed: 42data_seed: Noneuse_cpu: Falseaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedataloader_drop_last: Falsedataloader_num_workers: 0dataloader_pin_memory: Truedataloader_persistent_workers: Falsedataloader_prefetch_factor: Nonedataloader_multiprocessing_context: Nonedataloader_in_order: Trueremove_unused_columns: Truelabel_names: Nonetrain_sampling_strategy: randomlength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falseddp_static_graph: Noneddp_backend: Noneddp_timeout: 1800fsdp: Nonefsdp_config: Nonedeepspeed: Nonedebug: []skip_memory_metrics: Truedo_predict: Falseresume_from_checkpoint: Nonelocal_rank: -1prompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}warmup_ratio: None| Epoch | Step | Training Loss | Validation Loss |
|---|---|---|---|
| 0.0694 | 10 | 0.1333 | - |
| 0.1389 | 20 | 0.1208 | - |
| 0.2083 | 30 | 0.1361 | - |
| 0.2778 | 40 | 0.1059 | - |
| 0.3472 | 50 | 0.1800 | - |
| 0.4167 | 60 | 0.1108 | - |
| 0.4861 | 70 | 0.0975 | - |
| 0.5556 | 80 | 0.1652 | - |
| 0.625 | 90 | 0.1064 | - |
| 0.6944 | 100 | 0.1381 | - |
| 0.7639 | 110 | 0.1204 | - |
| 0.8333 | 120 | 0.1507 | - |
| 0.9028 | 130 | 0.1161 | - |
| 0.9722 | 140 | 0.0894 | - |
| 1.0 | 144 | - | 0.1144 |
| 1.0417 | 150 | 0.1071 | - |
| 1.1111 | 160 | 0.1373 | - |
| 1.1806 | 170 | 0.0721 | - |
| 1.25 | 180 | 0.1062 | - |
| 1.3194 | 190 | 0.1126 | - |
| 1.3889 | 200 | 0.1050 | - |
| 1.4583 | 210 | 0.0967 | - |
| 1.5278 | 220 | 0.0915 | - |
| 1.5972 | 230 | 0.1069 | - |
| 1.6667 | 240 | 0.1245 | - |
| 1.7361 | 250 | 0.1086 | - |
| 1.8056 | 260 | 0.1234 | - |
| 1.875 | 270 | 0.0997 | - |
| 1.9444 | 280 | 0.0782 | - |
| 2.0 | 288 | - | 0.1169 |
| 2.0139 | 290 | 0.1141 | - |
| 2.0833 | 300 | 0.1099 | - |
| 2.1528 | 310 | 0.1102 | - |
| 2.2222 | 320 | 0.0686 | - |
| 2.2917 | 330 | 0.0958 | - |
| 2.3611 | 340 | 0.0920 | - |
| 2.4306 | 350 | 0.0923 | - |
| 2.5 | 360 | 0.0754 | - |
| 2.5694 | 370 | 0.0931 | - |
| 2.6389 | 380 | 0.0891 | - |
| 2.7083 | 390 | 0.0877 | - |
| 2.7778 | 400 | 0.0869 | - |
| 2.8472 | 410 | 0.0812 | - |
| 2.9167 | 420 | 0.0877 | - |
| 2.9861 | 430 | 0.1244 | - |
| 3.0 | 432 | - | 0.1158 |
| 3.0556 | 440 | 0.0827 | - |
| 3.125 | 450 | 0.0957 | - |
| 3.1944 | 460 | 0.0777 | - |
| 3.2639 | 470 | 0.0754 | - |
| 3.3333 | 480 | 0.0861 | - |
| 3.4028 | 490 | 0.0844 | - |
| 3.4722 | 500 | 0.0760 | - |
| 3.5417 | 510 | 0.1026 | - |
| 3.6111 | 520 | 0.0762 | - |
| 3.6806 | 530 | 0.0866 | - |
| 3.75 | 540 | 0.0815 | - |
| 3.8194 | 550 | 0.0747 | - |
| 3.8889 | 560 | 0.0770 | - |
| 3.9583 | 570 | 0.1072 | - |
| 4.0 | 576 | - | 0.1112 |
| 4.0278 | 580 | 0.0711 | - |
| 4.0972 | 590 | 0.0776 | - |
| 4.1667 | 600 | 0.0969 | - |
| 4.2361 | 610 | 0.0946 | - |
| 4.3056 | 620 | 0.0632 | - |
| 4.375 | 630 | 0.0939 | - |
| 4.4444 | 640 | 0.0586 | - |
| 4.5139 | 650 | 0.0868 | - |
| 4.5833 | 660 | 0.0702 | - |
| 4.6528 | 670 | 0.0651 | - |
| 4.7222 | 680 | 0.0736 | - |
| 4.7917 | 690 | 0.0625 | - |
| 4.8611 | 700 | 0.0851 | - |
| 4.9306 | 710 | 0.0993 | - |
| 5.0 | 720 | 0.0723 | 0.1127 |
@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",
}