Sentence Similarity
sentence-transformers
Safetensors
xlm-roberta
feature-extraction
Generated from Trainer
dataset_size:80
loss:CoSENTLoss
Eval Results (legacy)
text-embeddings-inference
Instructions to use CDXV/result_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use CDXV/result_model with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("CDXV/result_model") sentences = [ "Children smiling and waving at camera", "The kids are frowning", "The people are eating omelettes.", "Near a couple of restaurants, two people walk across the street." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
huggingface.co/CDXV/hack_ai_embbedding_model
Browse files
README.md
CHANGED
|
@@ -8,32 +8,35 @@ tags:
|
|
| 8 |
- loss:CoSENTLoss
|
| 9 |
base_model: abdeljalilELmajjodi/model
|
| 10 |
widget:
|
| 11 |
-
- source_sentence:
|
| 12 |
-
juice.
|
| 13 |
sentences:
|
|
|
|
| 14 |
- The people are eating omelettes.
|
| 15 |
-
-
|
| 16 |
-
|
| 17 |
-
- source_sentence: An older man is drinking orange juice at a restaurant.
|
| 18 |
sentences:
|
| 19 |
-
-
|
|
|
|
| 20 |
- Two groups of rival gang members flipped each other off.
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
- source_sentence: People waiting to get on a train or just getting off.
|
| 23 |
sentences:
|
| 24 |
-
- There are people
|
| 25 |
-
- The
|
|
|
|
| 26 |
- There are two woman in this picture.
|
| 27 |
-
- source_sentence:
|
| 28 |
-
|
| 29 |
-
- A family of three is at the beach.
|
| 30 |
-
- A blond man getting a drink of water from a fountain in the park.
|
| 31 |
-
- The diners are at a restaurant.
|
| 32 |
-
- source_sentence: A couple playing with a little boy on the beach.
|
| 33 |
sentences:
|
| 34 |
-
-
|
| 35 |
-
-
|
| 36 |
-
- A
|
| 37 |
pipeline_tag: sentence-similarity
|
| 38 |
library_name: sentence-transformers
|
| 39 |
metrics:
|
|
@@ -50,10 +53,10 @@ model-index:
|
|
| 50 |
type: pair-score-evaluator-dev
|
| 51 |
metrics:
|
| 52 |
- type: pearson_cosine
|
| 53 |
-
value: 0.
|
| 54 |
name: Pearson Cosine
|
| 55 |
- type: spearman_cosine
|
| 56 |
-
value: 0.
|
| 57 |
name: Spearman Cosine
|
| 58 |
---
|
| 59 |
|
|
@@ -107,9 +110,9 @@ from sentence_transformers import SentenceTransformer
|
|
| 107 |
model = SentenceTransformer("sentence_transformers_model_id")
|
| 108 |
# Run inference
|
| 109 |
sentences = [
|
| 110 |
-
'
|
| 111 |
-
'A
|
| 112 |
-
'
|
| 113 |
]
|
| 114 |
embeddings = model.encode(sentences)
|
| 115 |
print(embeddings.shape)
|
|
@@ -118,9 +121,9 @@ print(embeddings.shape)
|
|
| 118 |
# Get the similarity scores for the embeddings
|
| 119 |
similarities = model.similarity(embeddings, embeddings)
|
| 120 |
print(similarities)
|
| 121 |
-
# tensor([[1.0000, 0.
|
| 122 |
-
# [0.
|
| 123 |
-
# [0.
|
| 124 |
```
|
| 125 |
<!--
|
| 126 |
### Direct Usage (Transformers)
|
|
@@ -155,10 +158,10 @@ You can finetune this model on your own dataset.
|
|
| 155 |
* Dataset: `pair-score-evaluator-dev`
|
| 156 |
* Evaluated with [<code>EmbeddingSimilarityEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.sentence_transformer.evaluation.EmbeddingSimilarityEvaluator)
|
| 157 |
|
| 158 |
-
| Metric | Value
|
| 159 |
-
|:--------------------|:-----------|
|
| 160 |
-
| pearson_cosine | 0.
|
| 161 |
-
| **spearman_cosine** | **0.
|
| 162 |
|
| 163 |
<!--
|
| 164 |
## Bias, Risks and Limitations
|
|
@@ -182,16 +185,16 @@ You can finetune this model on your own dataset.
|
|
| 182 |
* Size: 80 training samples
|
| 183 |
* Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>score</code>
|
| 184 |
* Approximate statistics based on the first 80 samples:
|
| 185 |
-
| | sentence1 | sentence2
|
| 186 |
-
|:--------|:-----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------
|
| 187 |
-
| type | string | string
|
| 188 |
-
| details | <ul><li>min: 10 tokens</li><li>mean:
|
| 189 |
* Samples:
|
| 190 |
-
| sentence1
|
| 191 |
-
|:--------------------------------------------------------------------------------------------------------------------------------------------------------
|
| 192 |
-
| <code>
|
| 193 |
-
| <code>
|
| 194 |
-
| <code>
|
| 195 |
* Loss: [<code>CoSENTLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosentloss) with these parameters:
|
| 196 |
```json
|
| 197 |
{
|
|
@@ -208,16 +211,16 @@ You can finetune this model on your own dataset.
|
|
| 208 |
* Size: 20 evaluation samples
|
| 209 |
* Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>score</code>
|
| 210 |
* Approximate statistics based on the first 20 samples:
|
| 211 |
-
| | sentence1 | sentence2 | score
|
| 212 |
-
|:--------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:--------------------------------------------------------------
|
| 213 |
-
| type | string | string | float
|
| 214 |
-
| details | <ul><li>min:
|
| 215 |
* Samples:
|
| 216 |
-
| sentence1
|
| 217 |
-
|:-------------------------------------------------------------------|:------------------------------------------------------|:-----------------|
|
| 218 |
-
| <code>
|
| 219 |
-
| <code>
|
| 220 |
-
| <code>
|
| 221 |
* Loss: [<code>CoSENTLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosentloss) with these parameters:
|
| 222 |
```json
|
| 223 |
{
|
|
@@ -342,14 +345,14 @@ You can finetune this model on your own dataset.
|
|
| 342 |
### Training Logs
|
| 343 |
| Epoch | Step | Training Loss | Validation Loss | pair-score-evaluator-dev_spearman_cosine |
|
| 344 |
|:-------:|:------:|:-------------:|:---------------:|:----------------------------------------:|
|
| 345 |
-
| 0.1 | 1 |
|
| 346 |
-
| 0.5 | 5 | 3.
|
| 347 |
-
| **1.0** | **10** | **
|
| 348 |
|
| 349 |
* The bold row denotes the saved checkpoint.
|
| 350 |
|
| 351 |
### Training Time
|
| 352 |
-
- **Training**:
|
| 353 |
|
| 354 |
### Framework Versions
|
| 355 |
- Python: 3.12.13
|
|
|
|
| 8 |
- loss:CoSENTLoss
|
| 9 |
base_model: abdeljalilELmajjodi/model
|
| 10 |
widget:
|
| 11 |
+
- source_sentence: Children smiling and waving at camera
|
|
|
|
| 12 |
sentences:
|
| 13 |
+
- The kids are frowning
|
| 14 |
- The people are eating omelettes.
|
| 15 |
+
- Near a couple of restaurants, two people walk across the street.
|
| 16 |
+
- source_sentence: Two women, holding food carryout containers, hug.
|
|
|
|
| 17 |
sentences:
|
| 18 |
+
- two coworkers cross pathes on a street
|
| 19 |
+
- The woman is wearing white.
|
| 20 |
- Two groups of rival gang members flipped each other off.
|
| 21 |
+
- source_sentence: A woman is walking across the street eating a banana, while a man
|
| 22 |
+
is following with his briefcase.
|
| 23 |
+
sentences:
|
| 24 |
+
- A woman eats a banana and walks across a street, and there is a man trailing behind
|
| 25 |
+
her.
|
| 26 |
+
- An elderly man sits in a small shop.
|
| 27 |
+
- The adults are both male and female.
|
| 28 |
- source_sentence: People waiting to get on a train or just getting off.
|
| 29 |
sentences:
|
| 30 |
+
- There are people waiting on a train.
|
| 31 |
+
- The two sisters saw each other across the crowded diner and shared a hug, both
|
| 32 |
+
clutching their doggie bags.
|
| 33 |
- There are two woman in this picture.
|
| 34 |
+
- source_sentence: The school is having a special event in order to show the american
|
| 35 |
+
culture on how other cultures are dealt with in parties.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
sentences:
|
| 37 |
+
- They are protesting outside the capital.
|
| 38 |
+
- A woman ordering pizza.
|
| 39 |
+
- A school is hosting an event.
|
| 40 |
pipeline_tag: sentence-similarity
|
| 41 |
library_name: sentence-transformers
|
| 42 |
metrics:
|
|
|
|
| 53 |
type: pair-score-evaluator-dev
|
| 54 |
metrics:
|
| 55 |
- type: pearson_cosine
|
| 56 |
+
value: -0.22939457943411037
|
| 57 |
name: Pearson Cosine
|
| 58 |
- type: spearman_cosine
|
| 59 |
+
value: -0.18637822325921868
|
| 60 |
name: Spearman Cosine
|
| 61 |
---
|
| 62 |
|
|
|
|
| 110 |
model = SentenceTransformer("sentence_transformers_model_id")
|
| 111 |
# Run inference
|
| 112 |
sentences = [
|
| 113 |
+
'The school is having a special event in order to show the american culture on how other cultures are dealt with in parties.',
|
| 114 |
+
'A school is hosting an event.',
|
| 115 |
+
'They are protesting outside the capital.',
|
| 116 |
]
|
| 117 |
embeddings = model.encode(sentences)
|
| 118 |
print(embeddings.shape)
|
|
|
|
| 121 |
# Get the similarity scores for the embeddings
|
| 122 |
similarities = model.similarity(embeddings, embeddings)
|
| 123 |
print(similarities)
|
| 124 |
+
# tensor([[1.0000, 0.9755, 0.9818],
|
| 125 |
+
# [0.9755, 1.0000, 0.9960],
|
| 126 |
+
# [0.9818, 0.9960, 1.0000]])
|
| 127 |
```
|
| 128 |
<!--
|
| 129 |
### Direct Usage (Transformers)
|
|
|
|
| 158 |
* Dataset: `pair-score-evaluator-dev`
|
| 159 |
* Evaluated with [<code>EmbeddingSimilarityEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.sentence_transformer.evaluation.EmbeddingSimilarityEvaluator)
|
| 160 |
|
| 161 |
+
| Metric | Value |
|
| 162 |
+
|:--------------------|:------------|
|
| 163 |
+
| pearson_cosine | -0.2294 |
|
| 164 |
+
| **spearman_cosine** | **-0.1864** |
|
| 165 |
|
| 166 |
<!--
|
| 167 |
## Bias, Risks and Limitations
|
|
|
|
| 185 |
* Size: 80 training samples
|
| 186 |
* Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>score</code>
|
| 187 |
* Approximate statistics based on the first 80 samples:
|
| 188 |
+
| | sentence1 | sentence2 | score |
|
| 189 |
+
|:--------|:-----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------|
|
| 190 |
+
| type | string | string | float |
|
| 191 |
+
| details | <ul><li>min: 10 tokens</li><li>mean: 25.76 tokens</li><li>max: 52 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 11.9 tokens</li><li>max: 29 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.48</li><li>max: 1.0</li></ul> |
|
| 192 |
* Samples:
|
| 193 |
+
| sentence1 | sentence2 | score |
|
| 194 |
+
|:-----------------------------------------------------------------------------------------------|:---------------------------------------------------------|:-----------------|
|
| 195 |
+
| <code>A man with blond-hair, and a brown shirt drinking out of a public water fountain.</code> | <code>A blond man drinking water from a fountain.</code> | <code>1.0</code> |
|
| 196 |
+
| <code>A man, woman, and child enjoying themselves on a beach.</code> | <code>A family of three is at the mall shopping.</code> | <code>0.0</code> |
|
| 197 |
+
| <code>A woman wearing all white and eating, walks next to a man holding a briefcase.</code> | <code>A married couple is sleeping.</code> | <code>0.0</code> |
|
| 198 |
* Loss: [<code>CoSENTLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosentloss) with these parameters:
|
| 199 |
```json
|
| 200 |
{
|
|
|
|
| 211 |
* Size: 20 evaluation samples
|
| 212 |
* Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>score</code>
|
| 213 |
* Approximate statistics based on the first 20 samples:
|
| 214 |
+
| | sentence1 | sentence2 | score |
|
| 215 |
+
|:--------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:--------------------------------------------------------------|
|
| 216 |
+
| type | string | string | float |
|
| 217 |
+
| details | <ul><li>min: 10 tokens</li><li>mean: 25.6 tokens</li><li>max: 52 tokens</li></ul> | <ul><li>min: 8 tokens</li><li>mean: 12.3 tokens</li><li>max: 29 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.6</li><li>max: 1.0</li></ul> |
|
| 218 |
* Samples:
|
| 219 |
+
| sentence1 | sentence2 | score |
|
| 220 |
+
|:---------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------|:-----------------|
|
| 221 |
+
| <code>A man and a woman cross the street in front of a pizza and gyro restaurant.</code> | <code>Near a couple of restaurants, two people walk across the street.</code> | <code>1.0</code> |
|
| 222 |
+
| <code>Woman in white in foreground and a man slightly behind walking with a sign for John's Pizza and Gyro in the background.</code> | <code>A woman ordering pizza.</code> | <code>0.5</code> |
|
| 223 |
+
| <code>An older man sits with his orange juice at a small table in a coffee shop while employees in bright colored shirts smile in the background.</code> | <code>A boy flips a burger.</code> | <code>0.0</code> |
|
| 224 |
* Loss: [<code>CoSENTLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosentloss) with these parameters:
|
| 225 |
```json
|
| 226 |
{
|
|
|
|
| 345 |
### Training Logs
|
| 346 |
| Epoch | Step | Training Loss | Validation Loss | pair-score-evaluator-dev_spearman_cosine |
|
| 347 |
|:-------:|:------:|:-------------:|:---------------:|:----------------------------------------:|
|
| 348 |
+
| 0.1 | 1 | 2.7147 | - | - |
|
| 349 |
+
| 0.5 | 5 | 3.4691 | - | - |
|
| 350 |
+
| **1.0** | **10** | **3.0569** | **2.7822** | **-0.1864** |
|
| 351 |
|
| 352 |
* The bold row denotes the saved checkpoint.
|
| 353 |
|
| 354 |
### Training Time
|
| 355 |
+
- **Training**: 3.3 minutes
|
| 356 |
|
| 357 |
### Framework Versions
|
| 358 |
- Python: 3.12.13
|