Sentence Similarity
sentence-transformers
Safetensors
bert
embeddings
cross-lingual
multilingual
igbo
hausa
yoruba
information-retrieval
semantic-search
text-embeddings-inference
Instructions to use Modularcomputing/Native-Bird with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Modularcomputing/Native-Bird with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Modularcomputing/Native-Bird") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
|
Download models/labse-ig-ha-yo/README.md from Modularcomputing/Native-Bird: direct link, hf CLI and curl.
- Browser
- Download file 17.2 kB
-
https://huggingface.co/Modularcomputing/Native-Bird/resolve/main/models/labse-ig-ha-yo/README.md
- Command line
-
hf download hf://Modularcomputing/Native-Bird/models/labse-ig-ha-yo/README.md
-
curl -L -o README.md https://huggingface.co/Modularcomputing/Native-Bird/resolve/main/models/labse-ig-ha-yo/README.md
17.2 kB
metadata
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- dense
- generated_from_trainer
- dataset_size:76150
- loss:CachedMultipleNegativesRankingLoss
- loss:MultipleNegativesRankingLoss
base_model: sentence-transformers/LaBSE
widget:
- source_sentence: po pelu ni akoko pelu awon
sentences:
- About time with them too.
- 'Us: We''re just like stars!'
- It can get you to the next day.
- source_sentence: Ki ló n ṣẹlẹ / Ki lo n shele?
sentences:
- Sure this time it's fine.
- What's going on/happened?
- (I've got something in my eye!
- source_sentence: ban ga laihi gare su int mm
sentences:
- '"Cities have been paralyzed"'
- I wouldn't blame them. (NM)
- Inside, there are no paths.
- source_sentence: '"A cikin gõnaki da marẽmari."'
sentences:
- How Many Days Are In A 2020?
- 'And they would say: "Our Lord!'
- —amid gardens and springs,
- source_sentence: Mo ti ri pe ninu ara mi ."
sentences:
- Bring my Soul out of Prison.
- I've found it within myself'."
- I looked and couldn't believe it!
pipeline_tag: sentence-similarity
library_name: sentence-transformers
SentenceTransformer based on sentence-transformers/LaBSE
This is a sentence-transformers model finetuned from sentence-transformers/LaBSE. It maps inputs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, classification, clustering, and more.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: sentence-transformers/LaBSE
- Maximum Sequence Length: 128 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
- Supported Modality: Text
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
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': 768, 'pooling_mode': 'cls', 'include_prompt': True})
(2): Dense({'in_features': 768, 'out_features': 768, 'bias': True, 'activation_function': 'torch.nn.modules.activation.Tanh', 'module_input_name': 'sentence_embedding', 'module_output_name': 'sentence_embedding'})
(3): Normalize({'module_input_name': 'sentence_embedding', 'module_output_name': 'sentence_embedding'})
)
Usage
Direct Usage (Sentence Transformers)
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 = [
'Mo ti ri pe ninu ara mi ."',
'I\'ve found it within myself\'."',
'Bring my Soul out of Prison.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.8338, 0.0731],
# [0.8338, 1.0000, 0.1770],
# [0.0731, 0.1770, 1.0000]])
Training Details
Training Dataset
Unnamed Dataset
- Size: 76,150 training samples
- Columns:
anchorandpositive - Approximate statistics based on the first 100 samples:
anchor positive type string string modality text text details - min: 9 tokens
- mean: 36.91 tokens
- max: 128 tokens
- min: 9 tokens
- mean: 35.99 tokens
- max: 128 tokens
- Samples:
anchor positive Ilé Ẹjọ́ Gíga Jù Lọ Nílẹ̀ Korea á lè lo ìdájọ́ tí Ilé Ẹjọ́ yìí ṣe nínú ọ̀rọ̀ ọ̀kọ̀ọ̀kan àwọn tí ẹ̀rí ọkàn wọn ò jẹ́ kí wọ́n ṣiṣẹ́ ológun.The Constitutional Court’s decision now opens the door for the Supreme Court of Korea to apply this ruling to specific cases involving conscientious objectors. Hundreds of thousands of people were evacuated, a process that proved to be especially complicated because of government-mandated physical distancing."Wanda Ya sanya muku ƙasa shimfiɗa, kuma Ya shigar muku da hanyõyi a cikinta, kuma Ya saukar da ruwa daga sama."Who has made earth for you like a bed (spread out); and has opened roads (ways and paths etc.) for you therein; and has sent down water (rain) from the sky.Ìwọ ni Èlíjà bí?"+ Ó sì wí pé: "Èmi kọ́."Are you Elijah?" and he says, "I am not." - Loss:
CachedMultipleNegativesRankingLosswith these parameters:{ "scale": 30.0, "similarity_fct": "cos_sim", "mini_batch_size": 128, "mini_batch_num_tokens": null, "gather_across_devices": false, "directions": [ "query_to_doc" ], "partition_mode": "joint", "hardness_mode": null, "hardness_strength": 0.0 }
Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size: 256num_train_epochs: 4.0learning_rate: 2e-05lr_scheduler_type: cosinewarmup_steps: 0.1bf16: Truedataloader_num_workers: 4batch_sampler: no_duplicates
All Hyperparameters
Click to expand
per_device_train_batch_size: 256num_train_epochs: 4.0max_steps: -1learning_rate: 2e-05lr_scheduler_type: cosinelr_scheduler_kwargs: Nonewarmup_steps: 0.1optim: 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: Truefp16: 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: 4dataloader_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: no_duplicatesmulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}warmup_ratio: None
Training Logs
| Epoch | Step | Training Loss |
|---|---|---|
| 0.0671 | 20 | 0.4747 |
| 0.1342 | 40 | 0.3165 |
| 0.2013 | 60 | 0.2757 |
| 0.2685 | 80 | 0.2269 |
| 0.3356 | 100 | 0.2092 |
| 0.4027 | 120 | 0.1850 |
| 0.4698 | 140 | 0.1616 |
| 0.5369 | 160 | 0.1554 |
| 0.6040 | 180 | 0.1499 |
| 0.6711 | 200 | 0.1600 |
| 0.7383 | 220 | 0.1278 |
| 0.8054 | 240 | 0.1107 |
| 0.8725 | 260 | 0.1230 |
| 0.9396 | 280 | 0.1177 |
| 1.0067 | 300 | 0.0924 |
| 1.0738 | 320 | 0.0679 |
| 1.1409 | 340 | 0.0665 |
| 1.2081 | 360 | 0.0771 |
| 1.2752 | 380 | 0.0646 |
| 1.3423 | 400 | 0.0757 |
| 1.4094 | 420 | 0.0728 |
| 1.4765 | 440 | 0.0767 |
| 1.5436 | 460 | 0.0732 |
| 1.6107 | 480 | 0.0615 |
| 1.6779 | 500 | 0.0639 |
| 1.7450 | 520 | 0.0576 |
| 1.8121 | 540 | 0.0686 |
| 1.8792 | 560 | 0.0585 |
| 1.9463 | 580 | 0.0655 |
| 2.0134 | 600 | 0.0615 |
| 2.0805 | 620 | 0.0430 |
| 2.1477 | 640 | 0.0376 |
| 2.2148 | 660 | 0.0377 |
| 2.2819 | 680 | 0.0384 |
| 2.3490 | 700 | 0.0393 |
| 2.4161 | 720 | 0.0365 |
| 2.4832 | 740 | 0.0421 |
| 2.5503 | 760 | 0.0367 |
| 2.6174 | 780 | 0.0433 |
| 2.6846 | 800 | 0.0360 |
| 2.7517 | 820 | 0.0363 |
| 2.8188 | 840 | 0.0370 |
| 2.8859 | 860 | 0.0295 |
| 2.9530 | 880 | 0.0327 |
| 3.0201 | 900 | 0.0321 |
| 3.0872 | 920 | 0.0318 |
| 3.1544 | 940 | 0.0249 |
| 3.2215 | 960 | 0.0248 |
| 3.2886 | 980 | 0.0236 |
| 3.3557 | 1000 | 0.0249 |
| 3.4228 | 1020 | 0.0332 |
| 3.4899 | 1040 | 0.0298 |
| 3.5570 | 1060 | 0.0283 |
| 3.6242 | 1080 | 0.0261 |
| 3.6913 | 1100 | 0.0346 |
| 3.7584 | 1120 | 0.0270 |
| 3.8255 | 1140 | 0.0284 |
| 3.8926 | 1160 | 0.0321 |
| 3.9597 | 1180 | 0.0267 |
Training Time
- Training: 5.0 minutes
Framework Versions
- Python: 3.12.3
- Sentence Transformers: 6.1.0
- Transformers: 5.19.0
- PyTorch: 2.13.0+cu129
- Accelerate: 1.15.0
- Datasets: 5.1.0
- Tokenizers: 0.23.2
Additional Resources
- Training and Finetuning Embedding Models with Sentence Transformers: the end-to-end guide for training or finetuning Sentence Transformer models.
- Introduction to Matryoshka Embedding Models: variable-size embeddings that can be truncated with minimal quality loss.
- Binary and Scalar Embedding Quantization for Significantly Faster & Cheaper Retrieval: post-training compression of embedding vectors.
- Multimodal Embedding & Reranker Models with Sentence Transformers: use text, image, audio, and video models through the same API.
- Training and Finetuning Multimodal Embedding & Reranker Models with Sentence Transformers: train multimodal embedding models, with a Visual Document Retrieval walkthrough.
Citation
BibTeX
Sentence Transformers
@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",
}
CachedMultipleNegativesRankingLoss
@misc{gao2021scaling,
title={Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup},
author={Luyu Gao and Yunyi Zhang and Jiawei Han and Jamie Callan},
year={2021},
eprint={2101.06983},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
MultipleNegativesRankingLoss
@misc{oord2019representationlearningcontrastivepredictive,
title={Representation Learning with Contrastive Predictive Coding},
author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
year={2019},
eprint={1807.03748},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/1807.03748},
}