Sentence Similarity
sentence-transformers
Safetensors
bert
feature-extraction
dense
text-embeddings-inference
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
Update README.md
Browse files
README.md
CHANGED
|
@@ -4,8 +4,7 @@ tags:
|
|
| 4 |
- sentence-similarity
|
| 5 |
- feature-extraction
|
| 6 |
- dense
|
| 7 |
-
|
| 8 |
-
- loss:MultipleNegativesRankingLoss
|
| 9 |
widget:
|
| 10 |
- source_sentence: Name a style of hot yoga.
|
| 11 |
sentences:
|
|
@@ -36,40 +35,47 @@ pipeline_tag: sentence-similarity
|
|
| 36 |
library_name: sentence-transformers
|
| 37 |
---
|
| 38 |
|
| 39 |
-
#
|
| 40 |
|
| 41 |
-
|
| 42 |
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
### Model Description
|
| 45 |
-
- **Model Type:** Sentence Transformer
|
| 46 |
-
- **Base
|
| 47 |
- **Maximum Sequence Length:** 256 tokens
|
| 48 |
- **Output Dimensionality:** 384 dimensions
|
| 49 |
- **Similarity Function:** Cosine Similarity
|
| 50 |
- **Supported Modality:** Text
|
| 51 |
|
| 52 |
### Model Sources
|
| 53 |
-
|
| 54 |
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
|
| 55 |
- **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers)
|
| 56 |
-
- **Hugging Face:** [
|
| 57 |
|
| 58 |
### Full Model Architecture
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
### Direct Usage (Sentence Transformers)
|
| 64 |
|
| 65 |
-
|
|
|
|
| 66 |
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
Then you can load this model and run inference. Pythonfrom sentence_transformers import SentenceTransformer
|
| 70 |
|
| 71 |
-
# Download from the 🤗 Hub
|
| 72 |
-
model = SentenceTransformer("sentence_transformers_model_id")
|
| 73 |
# Run inference
|
| 74 |
sentences = [
|
| 75 |
'How often is The Australian Chess Championship held?',
|
|
@@ -83,21 +89,9 @@ print(embeddings.shape)
|
|
| 83 |
# Get the similarity scores for the embeddings
|
| 84 |
similarities = model.similarity(embeddings, embeddings)
|
| 85 |
print(similarities)
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
Training DetailsColumns: sentence_0 and sentence_1Approximate statistics based on the first 100 samples:sentence_0sentence_1typestringstringmodalitytexttextdetailsmin: 3 tokensmean: 46.19 tokensmax: 256 tokensmin: 3 tokensmean: 134.39 tokensmax: 256 tokensLoss: MultipleNegativesRankingLoss with these parameters:JSON{
|
| 90 |
-
"scale": 20.0,
|
| 91 |
-
"similarity_fct": "cos_sim",
|
| 92 |
-
"gather_across_devices": false,
|
| 93 |
-
"directions": [
|
| 94 |
-
"query_to_doc"
|
| 95 |
-
],
|
| 96 |
-
"partition_mode": "joint",
|
| 97 |
-
"hardness_mode": null,
|
| 98 |
-
"hardness_strength": 0.0
|
| 99 |
-
}
|
| 100 |
-
Training HyperparametersNon-Default Hyperparametersper_device_train_batch_size: 32per_device_eval_batch_size: 32num_train_epochs: 1multi_dataset_batch_sampler: round_robinAll Hyperparametersdo_predict: Falseprediction_loss_only: Trueper_device_train_batch_size: 32per_device_eval_batch_size: 32gradient_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: 1max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_ratio: Nonewarmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Trueenable_jit_checkpoint: Falsesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseuse_cpu: Falseseed: 42data_seed: Nonebf16: Falsefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: -1ddp_backend: Nonedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonedisable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []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: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Nonegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Truepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_for_metrics: []eval_do_concat_batches: Trueauto_find_batch_size: Falsefull_determinism: Falseddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_num_input_tokens_seen: noneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Trueuse_cache: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}Training TimeTraining: 1.5 minutesAdditional ResourcesTraining and Finetuning Embedding Models with Sentence TransformersIntroduction to Matryoshka Embedding ModelsBinary and Scalar Embedding QuantizationCitationBibTeXSentence TransformersCode snippet@inproceedings{reimers-2019-sentence-bert,
|
| 101 |
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
|
| 102 |
author = "Reimers, Nils and Gurevych, Iryna",
|
| 103 |
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
|
|
@@ -106,7 +100,8 @@ Training HyperparametersNon-Default Hyperparametersper_device_train_batch_size:
|
|
| 106 |
publisher = "Association for Computational Linguistics",
|
| 107 |
url = "[https://arxiv.org/abs/1908.10084](https://arxiv.org/abs/1908.10084)",
|
| 108 |
}
|
| 109 |
-
|
|
|
|
| 110 |
title={Representation Learning with Contrastive Predictive Coding},
|
| 111 |
author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
|
| 112 |
year={2019},
|
|
|
|
| 4 |
- sentence-similarity
|
| 5 |
- feature-extraction
|
| 6 |
- dense
|
| 7 |
+
base_model: BAAI/bge-small-en-v1.5
|
|
|
|
| 8 |
widget:
|
| 9 |
- source_sentence: Name a style of hot yoga.
|
| 10 |
sentences:
|
|
|
|
| 35 |
library_name: sentence-transformers
|
| 36 |
---
|
| 37 |
|
| 38 |
+
# Kiel-2-Vector
|
| 39 |
|
| 40 |
+
**Kiel-2-Vector** is a dense embedding model based on `BAAI/bge-small-en-v1.5`. It maps inputs into a 384-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, classification, clustering, and more.
|
| 41 |
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
## Model Details
|
| 45 |
|
| 46 |
### Model Description
|
| 47 |
+
- **Model Type:** Sentence Transformer / Dense Embedding Backbone
|
| 48 |
+
- **Base Model:** [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5)
|
| 49 |
- **Maximum Sequence Length:** 256 tokens
|
| 50 |
- **Output Dimensionality:** 384 dimensions
|
| 51 |
- **Similarity Function:** Cosine Similarity
|
| 52 |
- **Supported Modality:** Text
|
| 53 |
|
| 54 |
### Model Sources
|
|
|
|
| 55 |
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
|
| 56 |
- **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers)
|
| 57 |
+
- **Hugging Face Hub:** [kiel2/Kiel-2-Vector](https://huggingface.co/kiel2/Kiel-2-Vector)
|
| 58 |
|
| 59 |
### Full Model Architecture
|
| 60 |
+
```text
|
| 61 |
+
SentenceTransformer(
|
| 62 |
+
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'BertModel'})
|
| 63 |
+
(1): Pooling({'embedding_dimension': 384, 'pooling_mode': 'mean', 'include_prompt': True})
|
| 64 |
+
(2): Normalize({'module_input_name': 'sentence_embedding', 'module_output_name': 'sentence_embedding'})
|
| 65 |
+
)
|
| 66 |
+
Direct Usage (Sentence Transformers)
|
| 67 |
+
First, install the Sentence Transformers library:
|
| 68 |
|
| 69 |
+
Bash
|
| 70 |
+
pip install -U sentence-transformers
|
| 71 |
+
Then load this model and run inference:
|
|
|
|
| 72 |
|
| 73 |
+
Python
|
| 74 |
+
from sentence_transformers import SentenceTransformer
|
| 75 |
|
| 76 |
+
# Load from the 🤗 Hub
|
| 77 |
+
model = SentenceTransformer("kiel2/Kiel-2-Vector")
|
|
|
|
| 78 |
|
|
|
|
|
|
|
| 79 |
# Run inference
|
| 80 |
sentences = [
|
| 81 |
'How often is The Australian Chess Championship held?',
|
|
|
|
| 89 |
# Get the similarity scores for the embeddings
|
| 90 |
similarities = model.similarity(embeddings, embeddings)
|
| 91 |
print(similarities)
|
| 92 |
+
Citation
|
| 93 |
+
Code snippet
|
| 94 |
+
@inproceedings{reimers-2019-sentence-bert,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
|
| 96 |
author = "Reimers, Nils and Gurevych, Iryna",
|
| 97 |
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
|
|
|
|
| 100 |
publisher = "Association for Computational Linguistics",
|
| 101 |
url = "[https://arxiv.org/abs/1908.10084](https://arxiv.org/abs/1908.10084)",
|
| 102 |
}
|
| 103 |
+
|
| 104 |
+
@misc{oord2019representationlearningcontrastivepredictive,
|
| 105 |
title={Representation Learning with Contrastive Predictive Coding},
|
| 106 |
author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
|
| 107 |
year={2019},
|