Sentence Similarity
sentence-transformers
Safetensors
bert
feature-extraction
dense
text-embeddings-inference
Run this model with HF Jobs
Run kiel2/Kiel-2-Vector on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/kiel2/Kiel-2-Vector. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/kiel2/Kiel-2-Vector on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use kiel2/Kiel-2-Vector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use kiel2/Kiel-2-Vector with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("kiel2/Kiel-2-Vector") sentences = [ "Name a style of hot yoga.", "Bikram.", "Tallahassee is the capital of Florida", "I want a redhead woman with tattoos and big boobs and a big ass" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse filesFiles changed (10)
- 1_Pooling/config.jsonAdded+5
- 2_Normalize/config.jsonAdded+4
- README.mdAdded+352
- config.jsonAdded+30
- config_sentence_transformers.jsonAdded+14
- model.safetensorsAdded+3
- modules.jsonAdded+20
- sentence_bert_config.jsonAdded+10
- tokenizer.jsonAdded
- tokenizer_config.jsonAdded+16
12345{ "embedding_dimension": 384, "pooling_mode": "mean", "include_prompt": true}1234{ "module_input_name": "sentence_embedding", "module_output_name": "sentence_embedding"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352---tags:- sentence-transformers- sentence-similarity- feature-extraction- dense- generated_from_trainer- dataset_size:10000- loss:MultipleNegativesRankingLosswidget:- source_sentence: Name a style of hot yoga. sentences: - Bikram. - Tallahassee is the capital of Florida - I want a redhead woman with tattoos and big boobs and a big ass- source_sentence: What is Orchesis - either professional or amateur sentences: - Art of Dancing - The Price Brothers and Company - Steve Jobs. Because of his invention.- source_sentence: What is the tiny piece at the end of a shoelace called? sentences: - Sinking Sand is most commonly known as Quicksand. - I would give the MVP award to Nikola Jokic. - An Aglet.- source_sentence: Who was given Stockholm Water Prize 2022 ? sentences: - Prof.Wilfried Brutsaert - Kingfisher - If you have 3 dimes, you have 30 cents.- source_sentence: How often is The Australian Chess Championship held? sentences: - Every two years - UC Berkeley; UCLA - Remove the - character and restore the split words in the markdown content.pipeline_tag: sentence-similaritylibrary_name: sentence-transformers---
# SentenceTransformer
This is a [sentence-transformers](https://www.SBERT.net) model trained. 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.
## Model Details
### Model Description- **Model Type:** Sentence Transformer<!-- - **Base model:** [Unknown](https://huggingface.co/unknown) -->- **Maximum Sequence Length:** 256 tokens- **Output Dimensionality:** 384 dimensions- **Similarity Function:** Cosine Similarity- **Supported Modality:** Text<!-- - **Training Dataset:** Unknown --><!-- - **Language:** Unknown --><!-- - **License:** Unknown -->
### 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({'module_input_name': 'sentence_embedding', 'module_output_name': 'sentence_embedding'}))```
## Usage
### Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
```bashpip install -U sentence-transformers```Then you can load this model and run inference.```pythonfrom sentence_transformers import SentenceTransformer
# Download from the 🤗 Hubmodel = SentenceTransformer("sentence_transformers_model_id")# Run inferencesentences = [ 'How often is The Australian Chess Championship held?', 'Every two years', 'Remove the - character and restore the split words in the markdown content.',]embeddings = model.encode(sentences)print(embeddings.shape)# [3, 384]
# Get the similarity scores for the embeddingssimilarities = model.similarity(embeddings, embeddings)print(similarities)# tensor([[ 1.0000, 0.4425, -0.0360],# [ 0.4425, 1.0000, -0.0410],# [-0.0360, -0.0410, 1.0000]])```<!--### Direct Usage (Transformers)
<details><summary>Click to see the direct usage in Transformers</summary>
</details>-->
<!--### Downstream Usage (Sentence Transformers)
You can finetune this model on your own dataset.
<details><summary>Click to expand</summary>
</details>-->
<!--### Out-of-Scope Use
*List how the model may foreseeably be misused and address what users ought not to do with the model.*-->
<!--## Bias, Risks and Limitations
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*-->
<!--### Recommendations
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*-->
## Training Details
### Training Dataset
#### Unnamed Dataset
* Size: 10,000 training samples* Columns: <code>sentence_0</code> and <code>sentence_1</code>* Approximate statistics based on the first 100 samples: | | sentence_0 | sentence_1 | |:---------|:-----------------------------------------------------------------------------------|:------------------------------------------------------------------------------------| | type | string | string | | modality | text | text | | details | <ul><li>min: 3 tokens</li><li>mean: 46.19 tokens</li><li>max: 256 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 134.39 tokens</li><li>max: 256 tokens</li></ul> |* Samples: | sentence_0 | sentence_1 | |:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>What performance was Chopin forced to decline due to his increasing ill health?</code> | <code>From 1842 onwards, Chopin showed signs of serious illness. After a solo recital in Paris on 21 February 1842, he wrote to Grzymała: "I have to lie in bed all day long, my mouth and tonsils are aching so much." He was forced by illness to decline a written invitation from Alkan to participate in a repeat performance of the Beethoven Seventh Symphony arrangement at Erard's on 1 March 1843. Late in 1844, Charles Hallé visited Chopin and found him "hardly able to move, bent like a half-opened penknife and evidently in great pain", although his spirits returned when he started to play the piano for his visitor. Chopin's health continued to deteriorate, particularly from this time onwards. Modern research suggests that apart from any other illnesses, he may also have suffered from temporal lobe epilepsy.</code> | | <code>Explain how sampling bias in Voice Of Customer research could adversely affect a marketing analysis of customers' post-purchase experience with a product.</code> | <code>Recently I bought a TV from Amazon after extensive research and analysis. The TV manufacturer promptly followed up two weeks after the purchase. The post-purchase experience survey had questions like the following: <br><br><br>· Did you buy it from a store/online? <br><br>· Are you satisfied with your order? <br><br>· Which store did you visit? <br><br>· Was the self-assembly instructions easy to follow? <br><br>· What other items would you consider purchasing from our brand? <br><br> <br>The above questions were too generic from the TV manufacturer, and they missed the mark in identifying me as a persona and my buying criteria. I bought the TV for my basement as a secondary TV, and I picked a TV brand with standard features to be cost-effective. Below are a few sampling biases from the survey <br><br><br>Buyer’s criteria <br><br>The survey didn’t identify the TV for primary usage. I purchased this as a secondary TV, and my expectations were low, but I’m satisfied with the TV. I wouldn’t have picked this brand if this was my prima...</code> | | <code>Read the following paragraph and determine if the hypothesis is true:<br><br>I was there last week .<br>And they were so interested .<br>Two days ago Miss Patty wrote me a note asking me to call ; and then she asked if I would take her gift to you .<br>What would you wish most from Patty 's Place , Anne ? ''<br>`` You ca n't mean that Miss Patty has sent me her china dogs ? ''<br>`` Go up head .<br>They 're in my trunk this very moment .<br>And I 've a letter for you .<br>Wait a moment and I 'll get it . ''<br>`` Dear Miss Shirley , '' Miss Patty had written , `` Maria and I were very much interested in hearing of your approaching nuptials .<br>We send you our best wishes .<br><br>Hypothesis: Miss Shirley's wedding is approaching. </code> | <code>To determine if the hypothesis is true, I will analyze the paragraph step by step to find evidence that supports the hypothesis.<br><br>1. Mention of Miss Patty shows some interest in Miss Shirley: "Two days ago Miss Patty wrote me a note asking me to call."<br>2. Miss Patty wanted to send a gift to Miss Shirley: "then she asked if I would take her gift to you."<br>3. The gift seems to be china dogs: "`` You ca n't mean that Miss Patty has sent me her china dogs ? ''"<br>4. Miss Patty also had a letter for Miss Shirley: "And I 've a letter for you."<br>5. In the letter, Miss Patty refers to Miss Shirley's upcoming wedding: "`` Dear Miss Shirley , '' Miss Patty had written , `` Maria and I were very much interested in hearing of your approaching nuptials."<br><br>Considering the evidence from the paragraph, particularly point 5 which states that Miss Patty and Maria are interested in hearing about Miss Shirley's "approaching nuptials," the hypothesis that Miss Shirley's wedding is approaching is true.</code> |* Loss: [<code>MultipleNegativesRankingLoss</code>](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- `num_train_epochs`: 1- `multi_dataset_batch_sampler`: round_robin
#### All Hyperparameters<details><summary>Click to expand</summary>
- `do_predict`: False- `prediction_loss_only`: True- `per_device_train_batch_size`: 32- `per_device_eval_batch_size`: 32- `gradient_accumulation_steps`: 1- `eval_accumulation_steps`: None- `torch_empty_cache_steps`: None- `learning_rate`: 5e-05- `weight_decay`: 0.0- `adam_beta1`: 0.9- `adam_beta2`: 0.999- `adam_epsilon`: 1e-08- `max_grad_norm`: 1- `num_train_epochs`: 1- `max_steps`: -1- `lr_scheduler_type`: linear- `lr_scheduler_kwargs`: None- `warmup_ratio`: None- `warmup_steps`: 0- `log_level`: passive- `log_level_replica`: warning- `log_on_each_node`: True- `logging_nan_inf_filter`: True- `enable_jit_checkpoint`: False- `save_on_each_node`: False- `save_only_model`: False- `restore_callback_states_from_checkpoint`: False- `use_cpu`: False- `seed`: 42- `data_seed`: None- `bf16`: False- `fp16`: False- `bf16_full_eval`: False- `fp16_full_eval`: False- `tf32`: None- `local_rank`: -1- `ddp_backend`: None- `debug`: []- `dataloader_drop_last`: False- `dataloader_num_workers`: 0- `dataloader_prefetch_factor`: None- `disable_tqdm`: False- `remove_unused_columns`: True- `label_names`: None- `load_best_model_at_end`: False- `ignore_data_skip`: False- `fsdp`: []- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': 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- `deepspeed`: None- `label_smoothing_factor`: 0.0- `optim`: adamw_torch_fused- `optim_args`: None- `group_by_length`: False- `length_column_name`: length- `project`: huggingface- `trackio_space_id`: trackio- `ddp_find_unused_parameters`: None- `ddp_bucket_cap_mb`: None- `ddp_broadcast_buffers`: False- `dataloader_pin_memory`: True- `dataloader_persistent_workers`: False- `skip_memory_metrics`: True- `push_to_hub`: False- `resume_from_checkpoint`: None- `hub_model_id`: None- `hub_strategy`: every_save- `hub_private_repo`: None- `hub_always_push`: False- `hub_revision`: None- `gradient_checkpointing`: False- `gradient_checkpointing_kwargs`: None- `include_for_metrics`: []- `eval_do_concat_batches`: True- `auto_find_batch_size`: False- `full_determinism`: False- `ddp_timeout`: 1800- `torch_compile`: False- `torch_compile_backend`: None- `torch_compile_mode`: None- `include_num_input_tokens_seen`: no- `neftune_noise_alpha`: None- `optim_target_modules`: None- `batch_eval_metrics`: False- `eval_on_start`: False- `use_liger_kernel`: False- `liger_kernel_config`: None- `eval_use_gather_object`: False- `average_tokens_across_devices`: True- `use_cache`: False- `prompts`: None- `batch_sampler`: batch_sampler- `multi_dataset_batch_sampler`: round_robin- `router_mapping`: {}- `learning_rate_mapping`: {}
</details>
### Training Time- **Training**: 1.5 minutes
### Framework Versions- Python: 3.12.13- Sentence Transformers: 6.1.0- Transformers: 5.0.0- PyTorch: 2.10.0+cu128- Accelerate: 1.13.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},}```
<!--## Glossary
*Clearly define terms in order to be accessible across audiences.*-->
<!--## Model Card Authors
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*-->
<!--## Model Card Contact
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*-->123456789101112131415161718192021222324252627282930{ "add_cross_attention": false, "architectures": [ "BertModel" ], "attention_probs_dropout_prob": 0.1, "bos_token_id": null, "classifier_dropout": null, "dtype": "float32", "eos_token_id": null, "gradient_checkpointing": false, "hidden_act": "gelu", "hidden_dropout_prob": 0.1, "hidden_size": 384, "initializer_range": 0.02, "intermediate_size": 1536, "is_decoder": false, "layer_norm_eps": 1e-12, "max_position_embeddings": 512, "model_type": "bert", "num_attention_heads": 12, "num_hidden_layers": 6, "pad_token_id": 0, "position_embedding_type": "absolute", "tie_word_embeddings": true, "transformers_version": "5.0.0", "type_vocab_size": 2, "use_cache": false, "vocab_size": 30522}1234567891011121314{ "__version__": { "pytorch": "2.10.0+cu128", "sentence_transformers": "6.1.0", "transformers": "5.0.0" }, "default_prompt_name": null, "model_type": "SentenceTransformer", "prompts": { "document": "", "query": "" }, "similarity_fn_name": "cosine"}123version https://git-lfs.github.com/spec/v1oid sha256:5340a58783743404d2e353caca4b9089472cd52890f3f101b28383fbca2b7eeesize 908641761234567891011121314151617181920[ { "idx": 0, "name": "0", "path": "", "type": "sentence_transformers.base.modules.transformer.Transformer" }, { "idx": 1, "name": "1", "path": "1_Pooling", "type": "sentence_transformers.sentence_transformer.modules.pooling.Pooling" }, { "idx": 2, "name": "2", "path": "2_Normalize", "type": "sentence_transformers.base.modules.normalize.Normalize" }]12345678910{ "transformer_task": "feature-extraction", "modality_config": { "text": { "method": "forward", "method_output_name": "last_hidden_state" } }, "module_output_name": "token_embeddings"}12345678910111213141516{ "backend": "tokenizers", "cls_token": "[CLS]", "do_basic_tokenize": true, "do_lower_case": true, "is_local": true, "mask_token": "[MASK]", "model_max_length": 256, "never_split": null, "pad_token": "[PAD]", "sep_token": "[SEP]", "strip_accents": null, "tokenize_chinese_chars": true, "tokenizer_class": "BertTokenizer", "unk_token": "[UNK]"}1_Pooling/config.jsonAdded+5
2_Normalize/config.jsonAdded+4
README.mdAdded+352
config.jsonAdded+30
config_sentence_transformers.jsonAdded+14
model.safetensorsAdded+3
modules.jsonAdded+20
sentence_bert_config.jsonAdded+10
tokenizer.jsonAdded
tokenizer_config.jsonAdded+16