Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 15
How to use austinpatrickm/gte-multilingual-base-finetuned with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("austinpatrickm/gte-multilingual-base-finetuned", trust_remote_code=True)
sentences = [
"How can I add the program to my antivirus exception list to stop these \"Access is denied\" errors when saving files?",
"Title: Russian Federation \"Google Tax\"\nAnswer: Payment of Taxes to the Russian Federation Residents from the Russian Federation need to pay tax on their online purchases.This 20% tax is one that is forced upon all online sales to the Russian Federation.We as a seller are obliged to pay this tax to your country for each purchase in our web shop by citizens of the Russian Federation.[I](https://tax.thomsonreuters.com/blog/tax/indirect-tax/google-tax-is-coming-to-russia/)mage-Line Support Team",
"Document_title: Tools Menu\nFile_name: menu_tools.htm\nHeading_hierarchy: [Tools Menu]\nAnchor_id: [none]\n[Image: Top menu bar with text options | Ref: img_shot/menu_bar_selecttools.png] The Tools menu contains useful tools for working with channels, patterns, effects and provides the ability to use external applications as tools inside FL Studio.",
"Title: Cannot create file / Access is denied / Unable to write to / Couldn't create the file / Please check that no other application is currently using it\nAnswer: Anti virus programs can trigger one or more of the following error messages: Error messages: Cannot create file 'C:\\Users\\[USER]\\Documents\\Image-Line\\FLEX\\Images\\[Filename].jpg'. Access is denied. Cannot create file 'C:\\Users\\[USER]\\Documents\\Image-Line\\FL Studio\\Audio\\Sliced audio\\[Filename].wav'. Access is denied. Cannot create file \"C:\\Users\\[USER]\\Documents\\Image-Line\\FL Studio\\Presets\\Clipboard files\\Audio clipboard.wav\". Access is denied. Unable to write to C:\\Users\\[USER]\\Documents\\Image-Line\\FLEX\\Packs\\[Filename].ini. Couldn't create the file\n'[Filename].wav'. Please check that no other application is currently using it. As [USER] for example: John (your Windows account name)As [Filename] for example: Arksun Cityscape-1.jpg, Arksun Cityscape-1.ini, recording.wav Symptoms: Can't render audio, \"Couldn't create the file '[Filename].wav'. Please check that no other application is currently using it.\" error is showing up. FLEX doesn't work, \"Cannot create file 'C:\\Users\\[USER]\\Documents\\Image-Line\\FLEX\\Images\\[Filename].jpg'. Access is denied.\", \"Unable to write to\nC:\\Users\\[USER]\\Documents\\Image-Line\\FLEX\\Packs\\[Filename].ini.\" error is showing up. You can't drag and drop files from NewTone, NewTime or Edison into FL Studio. You can't use \"paste from clipboard\" as \"Cannot create file \"C:\\Users\\[USER]\\Documents\\Image-Line\\FL Studio\\Presets\\Clipboard files\\Audio clipboard.wav\". Access is denied.\" error is showing up. You can't consolidate or quickrender tracks or patterns as \"Couldn't create the file '[Filename].wav'. Please check that no other application is currently using it.\" error is showing up. You try to render audio and the file is not\nshowing up, this could also be caused by an Antivirus. Please check if Avast or AVG Anti-virus is installed. Avast and AVG block the usage of the document folder for FL Studio. The solution is to add FL Studio to the exception list. Fix for Avast: 1: Open Avast and navigate to the Avast dashboard 2: Click Menu and click the Settings tab. Click the Exclusions tab under the General tab 3: Add > add the path of the installation folder from FL Studio > add to Avast whitelist Fix for AVG: 1: Open the AVG Dashboard > Menu > Settings 2: Click on General > Exceptions > Add\nException 3: Click on Browse > navigate to the installation folder of FL Studio Other solutions: If the solutions above does not help, these could be some issues, have a look at the article linked below: Wrong user data location Controlled Folder Access is activated [FL Studio | Failed to create user data folder / Unable to create file / Errors saving data](https://support.image-line.com/action/knowledgebase?ans=646) Please report this issue to your Antivirus provider, so they are able to add FL Studio to their database. As FL Studio is always evolving, the code signature/fingerprint AVG\nand Avast is using changes and will again be blocked in the future. Image-Line Support Team"
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]This is a sentence-transformers model finetuned from Alibaba-NLP/gte-multilingual-base. 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.
SentenceTransformer(
(0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: NewModel
(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): Normalize()
)
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("sentence_transformers_model_id")
# Run inference
sentences = [
'If I save the project after clicking "Continue," will the missing files be automatically relinked or do I need to fix the file paths manually?',
'Title: Error: no disk in drive\nAnswer: Issue This error usually occurs when an FLP (FL Studio project) looks for a sample/file in a location that doesn\'t exist (disconnected/offline drives or renamed drives) or one that doesn\'t have a disc inserted (DVD drive for example). Solution Click "Continue" and let the FLP load until the end. Save the project and the message should no longer present for that project. Note: If the error still presents itself after following the above steps try restarting your computer. Image-Line Support Team',
'Document_title: The Playlist \nFile_name: playlist.htm\nHeading_hierarchy: [The Playlist -> Universal Clip Editing Methods]\nAnchor_id: [none]\n• Snap settings ( [Image: Horseshoe magnet icon, gray background | Ref: img_glob/flicon_snap.png] ) - Snap controls how Clips move on the Playlist grid and many of the other editing functions below. Set this to \' line \' if you want the Clips to snap to bar boundaries or to \' none \' if you want to\nfreely position & slice Clips. • Inserting Clips - To insert a Clip, select the Clip you want to place from the Clip Source menu (indicated above) OR Right-Click the Clip focus selectors (indicated above) to choose Clips of the type selected. Next, in Draw ( [Image: Gray pencil drawing/editing tool\nicon | Ref: img_glob/flicon_pencilup.png] ) or Paint ( [Image: Paintbrush dripping with liquid icon | Ref: img_glob/flicon_paint.png] ) mode, Left-click on an empty area of a Clips track where you want to place the Clip. Paint mode allows you to paint multiple instances of the Clip at once (hold the\nMouse button & drag). • Insert time into the Playlist (shift Clips to the right) - Hold ( Ctrl ), click and drag on the time-line at the top of the Playlist starting from the point you want to insert space into the timeline AND for the duration of the insertion you want. With ( Ctrl ) still held press the ( Ins\nert ) key on your keyboard. Insert time into the Playlist (slice and move Clips to the right) - Make a time selection as above, then hold ( Ctrl+Alt ) and press the ( Insert ) key on your keyboard. The slice point will be at the start of the selection. • Delete a time selection - Hold ( Ctrl ), click and\ndrag on the time-line at the\n top of the Playlist to select the region to be deleted. Press ( Ctrl+Del ) to delete all patterns in the current selection and move Clips to the right of the selection into the gap. • Select Clips - To make a selection of more than one Clip. Use the [Image: Dashed square crop selection icon | Ref:\nimg_glob/flicon_select.png] Select tool and click and drag a rectangle around the Clips to be selected. To add Clips to this selection hold the ( Shift ) key and make further selections. OR if you are in Draw or Paint mode, hold ( Ctrl ) key and you will drop into Select mode while the ( Ctrl ) key is\nheld. Holding the ( Ctrl+Shift ) keys will allow you to add and remove Clips to / from an existing selection. OR use the Magic lasso feature. Move your Mouse pointer in a loop that encloses the Clips you want to select (no clicking required, it\'s \'magic\' remember). Make sure you have no Clips\nselected before you perform the lasso action (Right-Click the empty Playlist to deselect all Clips and make another selection). • Zoom to area - ( Ctrl+Right-Click ) and drag over a selection of the Playlist. Un-Zoom area - ( Ctrl+Right-Click ) anywhere\n on the Playlist (don\'t drag). • Zoom to a Clip - ( Ctrl+Shift+Right-Click ) on a Clip will maximize the zoom\n of the Playlist to the selected Clip. To Un-Zoom Clip - ( Ctrl+Right-Click ) anywhere\n on the Playlist (don\'t drag in this mode since that is how to zoom to selection). • Delete/Erase a Clip - Right-Click the target Clip or use the left Mouse button if you are in erase ( [Image: Circular gray "no entry" symbol icon | Ref: img_glob/flicon_delete.png] ) mode. • Copy/Paste Clips - Make\na selection, release the Mouse and any keys held, then hold the ( Shift ) key, then click on the selection and drag. A copy of the selection will follow the Mouse cursor. Release the selection when the Clips are in the alternative location. NOTE: In \' Slice tool \' mode this will initiate a slice, not\ncopy. OR Make a selection, press ( Ctrl+C ) to copy, then scroll the Playlist so that the starting bar for the paste location is at the left edge of the Playlist and press ( Ctrl+V ). • Duplicate selection - Make a selection and press ( Ctrl+B ). The selection, or all Clips if no selection is made, will be\nduplicated to the right of the original selection.',
]
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]
InformationRetrievalEvaluator| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.8225 |
| cosine_accuracy@3 | 0.9548 |
| cosine_accuracy@5 | 0.9764 |
| cosine_accuracy@10 | 0.9919 |
| cosine_precision@1 | 0.8225 |
| cosine_precision@3 | 0.3183 |
| cosine_precision@5 | 0.1953 |
| cosine_precision@10 | 0.0992 |
| cosine_recall@1 | 0.8225 |
| cosine_recall@3 | 0.9548 |
| cosine_recall@5 | 0.9764 |
| cosine_recall@10 | 0.9919 |
| cosine_ndcg@10 | 0.9157 |
| cosine_mrr@10 | 0.8903 |
| cosine_map@100 | 0.8908 |
sentence_0 and sentence_1| sentence_0 | sentence_1 | |
|---|---|---|
| type | string | string |
| details |
|
|
| sentence_0 | sentence_1 |
|---|---|
How long does it usually take for the payment status to update from 'unpaid' to 'processed' on the site? |
Title: My payment at my online bank page shows as processed, but your site still says 'unpaid'. |
If refreshing the order status page doesn't update the payment status, what should I do next? |
Title: My payment at my online bank page shows as processed, but your site still says 'unpaid'. |
Why do delay echoes not work properly with BooBass? |
Document_title: BooBass |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
eval_strategy: stepsper_device_train_batch_size: 10per_device_eval_batch_size: 10num_train_epochs: 2multi_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 10per_device_eval_batch_size: 10per_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: 1num_train_epochs: 2max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.0warmup_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: Falsefp16_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}tp_size: 0fsdp_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}deepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torchoptim_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: Falsegradient_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: Falseeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robin| Epoch | Step | Training Loss | cosine_ndcg@10 |
|---|---|---|---|
| 0.0847 | 50 | - | 0.8699 |
| 0.1695 | 100 | - | 0.8846 |
| 0.2542 | 150 | - | 0.8902 |
| 0.3390 | 200 | - | 0.9001 |
| 0.4237 | 250 | - | 0.9052 |
| 0.5085 | 300 | - | 0.9056 |
| 0.5932 | 350 | - | 0.9073 |
| 0.6780 | 400 | - | 0.9108 |
| 0.7627 | 450 | - | 0.9097 |
| 0.8475 | 500 | 0.0591 | 0.9157 |
@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",
}
@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}
}
Base model
Alibaba-NLP/gte-multilingual-base