--- 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](https://www.SBERT.net) model finetuned from [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/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](https://huggingface.co/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](https://sbert.net) - **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers) - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers) ### 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: ```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("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, and sentence_2 * Approximate statistics based on the first 100 samples: | | sentence_0 | sentence_1 | sentence_2 | |:---------|:----------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------| | type | string | string | string | | modality | text | text | text | | details | | | | * 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: [MultipleNegativesRankingLoss](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters: ```json { "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`: 32 - `per_device_eval_batch_size`: 32 - `multi_dataset_batch_sampler`: round_robin #### All Hyperparameters
Click to expand - `per_device_train_batch_size`: 32 - `num_train_epochs`: 3 - `max_steps`: -1 - `learning_rate`: 5e-05 - `lr_scheduler_type`: linear - `lr_scheduler_kwargs`: None - `warmup_steps`: 0 - `optim`: adamw_torch_fused - `optim_args`: None - `weight_decay`: 0.0 - `adam_beta1`: 0.9 - `adam_beta2`: 0.999 - `adam_epsilon`: 1e-08 - `optim_target_modules`: None - `gradient_accumulation_steps`: 1 - `average_tokens_across_devices`: True - `max_grad_norm`: 1 - `label_smoothing_factor`: 0.0 - `bf16`: False - `fp16`: False - `bf16_full_eval`: False - `fp16_full_eval`: False - `tf32`: None - `gradient_checkpointing`: False - `gradient_checkpointing_kwargs`: None - `torch_compile`: False - `torch_compile_backend`: None - `torch_compile_mode`: None - `use_liger_kernel`: False - `liger_kernel_config`: None - `use_cache`: False - `neftune_noise_alpha`: None - `torch_empty_cache_steps`: None - `auto_find_batch_size`: False - `log_on_each_node`: True - `logging_nan_inf_filter`: True - `include_num_input_tokens_seen`: no - `log_level`: passive - `log_level_replica`: warning - `disable_tqdm`: False - `project`: huggingface - `trackio_space_id`: None - `trackio_bucket_id`: None - `trackio_static_space_id`: None - `per_device_eval_batch_size`: 32 - `prediction_loss_only`: True - `eval_on_start`: False - `eval_do_concat_batches`: True - `eval_use_gather_object`: False - `eval_accumulation_steps`: None - `include_for_metrics`: [] - `batch_eval_metrics`: False - `save_only_model`: False - `save_on_each_node`: False - `enable_jit_checkpoint`: False - `push_to_hub`: False - `hub_private_repo`: None - `hub_model_id`: None - `hub_strategy`: every_save - `hub_always_push`: False - `hub_revision`: None - `load_best_model_at_end`: False - `ignore_data_skip`: False - `restore_callback_states_from_checkpoint`: False - `full_determinism`: False - `seed`: 42 - `data_seed`: None - `use_cpu`: False - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None} - `parallelism_config`: None - `dataloader_drop_last`: False - `dataloader_num_workers`: 0 - `dataloader_pin_memory`: True - `dataloader_persistent_workers`: False - `dataloader_prefetch_factor`: None - `remove_unused_columns`: True - `label_names`: None - `train_sampling_strategy`: random - `length_column_name`: length - `ddp_find_unused_parameters`: None - `ddp_bucket_cap_mb`: None - `ddp_broadcast_buffers`: False - `ddp_static_graph`: None - `ddp_backend`: None - `ddp_timeout`: 1800 - `fsdp`: None - `fsdp_config`: None - `deepspeed`: None - `debug`: [] - `skip_memory_metrics`: True - `do_predict`: False - `resume_from_checkpoint`: None - `warmup_ratio`: None - `local_rank`: -1 - `prompts`: None - `batch_sampler`: batch_sampler - `multi_dataset_batch_sampler`: round_robin - `router_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](https://huggingface.co/blog/train-sentence-transformers): the end-to-end guide for training or finetuning Sentence Transformer models. - [Introduction to Matryoshka Embedding Models](https://huggingface.co/blog/matryoshka): variable-size embeddings that can be truncated with minimal quality loss. - [Binary and Scalar Embedding Quantization for Significantly Faster & Cheaper Retrieval](https://huggingface.co/blog/embedding-quantization): post-training compression of embedding vectors. - [Multimodal Embedding & Reranker Models with Sentence Transformers](https://huggingface.co/blog/multimodal-sentence-transformers): use text, image, audio, and video models through the same API. - [Training and Finetuning Multimodal Embedding & Reranker Models with Sentence Transformers](https://huggingface.co/blog/train-multimodal-sentence-transformers): train multimodal embedding models, with a Visual Document Retrieval walkthrough. ## 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{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}, } ```