Sentence Similarity
sentence-transformers
Safetensors
bert
feature-extraction
dense
Generated from Trainer
dataset_size:4555
loss:MultipleNegativesRankingLoss
text-embeddings-inference
Instructions to use SSHHIVANI/verifact-biencoder-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use SSHHIVANI/verifact-biencoder-v1 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("SSHHIVANI/verifact-biencoder-v1") sentences = [ "Shahid Kapoor was in a film.", "In addition to acting in films , Kapoor has sung several of her film songs .", "Two years later , he played a drug abusing singer in the crime drama Udta Punjab , which won him the Filmfare Critics Award for Best Actor .", "Matthew Paige Damon -LRB- -LSB- ˈdeɪmən -RSB- born October 8 , 1970 -RRB- is an American actor , film producer , and screenwriter ." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
|
Download README.md from SSHHIVANI/verifact-biencoder-v1: direct link, hf CLI and curl.
- Browser
- Download file 17.6 kB
-
https://huggingface.co/SSHHIVANI/verifact-biencoder-v1/resolve/main/README.md
- Command line
-
hf download hf://SSHHIVANI/verifact-biencoder-v1/README.md
-
curl -L -o README.md https://huggingface.co/SSHHIVANI/verifact-biencoder-v1/resolve/main/README.md
17.6 kB
metadata
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- dense
- generated_from_trainer
- dataset_size:4555
- loss:MultipleNegativesRankingLoss
base_model: sentence-transformers/all-MiniLM-L6-v2
widget:
- source_sentence: Shahid Kapoor was in a film.
sentences:
- >-
In addition to acting in films , Kapoor has sung several of her film
songs .
- >-
Two years later , he played a drug abusing singer in the crime drama
Udta Punjab , which won him the Filmfare Critics Award for Best Actor .
- >-
Matthew Paige Damon -LRB- -LSB- ˈdeɪmən -RSB- born October 8 , 1970
-RRB- is an American actor , film producer , and screenwriter .
- source_sentence: Robert Redford is a performer.
sentences:
- >-
Grey 's Anatomy is an American medical drama television series that
premiered on American Broadcasting Company -LRB- ABC -RRB- as a
mid-season replacement on March 27 , 2005 .
- >-
Charles Robert Redford Jr. -LRB- born August 18 , 1936 -RRB- is an
American actor , director , producer , businessman , environmentalist ,
and philanthropist .
- >-
Redford 's career began in 1960 as a guest star on numerous TV shows ,
including : The Untouchables , Perry Mason , Alfred Hitchcock Presents ,
and The Twilight Zone , among others .
- source_sentence: Boeing 777 planes have two engines.
sentences:
- >-
It is the world 's largest twinjet and has a typical seating capacity of
314 to 396 passengers , with a range of 5240 to .
- >-
Bush married Laura Welch in 1977 and ran unsuccessfully for the House of
Representatives shortly thereafter .
- >-
The Boeing 777 is a family of long-range wide-body twin-engine jet
airliners developed and manufactured by Boeing Commercial Airplanes .
- source_sentence: >-
The Academy Honorary Award was put in place for a prize formerly named the
Special Award.
sentences:
- >-
The Academy Honorary Award -- instituted in 1948 for the 21st Academy
Awards -LRB- previously called the Special Award , which was first
presented in early 1929 -RRB- -- is given annually by the Board of
Governors of the Academy of Motion Picture Arts and Sciences -LRB- AMPAS
-RRB- to celebrate motion picture achievements that are not covered by
existing Academy Awards , although prior winners of competitive Academy
Awards are not excluded from receiving the Honorary Award .
- >-
In 2011 , Hathaway voiced Jewel in the animated film Rio and hosted the
83rd Academy Awards with James Franco , which was nominated for a
Primetime Emmy Award for Outstanding Special Class Program .
- >-
The song was performed during the Super Bowl XXXVIII halftime show in
2004 .
- source_sentence: Instagram started supporting videos in 2015.
sentences:
- >-
In 2015 , she reprised her role as Lindsay in Wet Hot American Summer
for the Netflix miniseries Wet Hot American Summer : First Day of Camp .
- >-
Instagram is a mobile , desktop , and internet-based photo-sharing
application and service that allows users to share pictures and videos
either publicly or privately .
- >-
Support for videos was originally launched in June 2013 , and had a
15-second maximum duration and limited quality , with Instagram later
adding support for widescreen and longer videos .
pipeline_tag: sentence-similarity
library_name: sentence-transformers
SentenceTransformer based on sentence-transformers/all-MiniLM-L6-v2
This is a sentence-transformers model finetuned from sentence-transformers/all-MiniLM-L6-v2. It maps sentences & paragraphs to a 384-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/all-MiniLM-L6-v2
- Maximum Sequence Length: 256 tokens
- Output Dimensionality: 384 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': 384, 'pooling_mode': 'mean', 'include_prompt': True})
(2): Normalize({})
)
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 = [
'Instagram started supporting videos in 2015.',
'Support for videos was originally launched in June 2013 , and had a 15-second maximum duration and limited quality , with Instagram later adding support for widescreen and longer videos .',
'Instagram is a mobile , desktop , and internet-based photo-sharing application and service that allows users to share pictures and videos either publicly or privately .',
]
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.8020, 0.5034],
# [0.8020, 1.0000, 0.5358],
# [0.5034, 0.5358, 1.0000]])
Training Details
Training Dataset
Unnamed Dataset
- Size: 4,555 training samples
- Columns:
sentence_0,sentence_1, andsentence_2 - Approximate statistics based on the first 100 samples:
sentence_0 sentence_1 sentence_2 type string string string modality text text text details - min: 6 tokens
- mean: 11.45 tokens
- max: 21 tokens
- min: 13 tokens
- mean: 37.74 tokens
- max: 131 tokens
- min: 9 tokens
- mean: 35.88 tokens
- max: 103 tokens
- Samples:
sentence_0 sentence_1 sentence_2 Grace Jones performed in 1984 film Conan the Destroyer.In 1984 she made her first mainstream appearance as Zula in the fantasy-action film Conan the Destroyer alongside Arnold Schwarzenegger and Sarah Douglas , and subsequently appeared in the 1985 James Bond movie A View to a Kill as May Day .In 2008 , he played Henry `` Mutt Williams '' Jones III in Indiana Jones and the Kingdom of the Crystal Skull , the fourth film in the Indiana Jones franchise .Pornhub is a website for pornography.Pornhub is a pornographic video sharing website and the largest pornography site on the Internet .There are contanious -LSB- sic -RSB- sexual scenes , abusive words , audio pornography and a bit sensitive touch about one particular section of society '' .The Beatles were an English soccer team.In 2008 , the group topped Billboard magazine 's list of the all-time most successful `` Hot 100 '' artists ; , they hold the record for most number-one hits on the Hot 100 chart with twenty .The Beatles were an English rock band formed in Liverpool in 1960 . - Loss:
MultipleNegativesRankingLosswith these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim", "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: 32per_device_eval_batch_size: 32multi_dataset_batch_sampler: round_robin
All Hyperparameters
Click to expand
per_device_train_batch_size: 32num_train_epochs: 3max_steps: -1learning_rate: 5e-05lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_steps: 0optim: 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: 1label_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: 32prediction_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: Noneremove_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: Nonewarmup_ratio: Nonelocal_rank: -1prompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}
Training Time
- Training: 59.1 minutes
Framework Versions
- Python: 3.13.7
- Sentence Transformers: 5.7.0
- Transformers: 5.14.1
- PyTorch: 2.13.0+cpu
- Accelerate: 1.14.0
- Datasets: 5.0.1
- Tokenizers: 0.22.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",
}
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},
}