---
language: []
library_name: sentence-transformers
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:1115700
- loss:MatryoshkaLoss
- loss:MultipleNegativesRankingLoss
base_model: UBC-NLP/serengeti-E250
datasets: []
metrics:
- pearson_cosine
- spearman_cosine
- pearson_manhattan
- spearman_manhattan
- pearson_euclidean
- spearman_euclidean
- pearson_dot
- spearman_dot
- pearson_max
- spearman_max
widget:
- source_sentence: Ndege mwenye mdomo mrefu katikati ya ndege.
sentences:
- Panya anayekimbia juu ya gurudumu.
- Mtu anashindana katika mashindano ya mbio.
- Ndege anayeruka.
- source_sentence: Msichana mchanga mwenye nywele nyeusi anakabili kamera na kushikilia
mfuko wa karatasi wakati amevaa shati la machungwa na mabawa ya kipepeo yenye
rangi nyingi.
sentences:
- Mwanamke mzee anakataa kupigwa picha.
- mtu akila na mvulana mdogo kwenye kijia cha jiji
- Msichana mchanga anakabili kamera.
- source_sentence: Wanawake na watoto wameketi nje katika kivuli wakati kikundi cha
watoto wadogo wameketi ndani katika kivuli.
sentences:
- Mwanamke na watoto na kukaa chini.
- Mwanamke huyo anakimbia.
- Watu wanasafiri kwa baiskeli.
- source_sentence: Mtoto mdogo anaruka mikononi mwa mwanamke aliyevalia suti nyeusi
ya kuogelea akiwa kwenye dimbwi.
sentences:
- Mtoto akiruka mikononi mwa mwanamke aliyevalia suti ya kuogelea kwenye dimbwi.
- Someone is holding oranges and walking
- Mama na binti wakinunua viatu.
- source_sentence: Mwanamume na mwanamke wachanga waliovaa mikoba wanaweka au kuondoa
kitu kutoka kwenye mti mweupe wa zamani, huku watu wengine wamesimama au wameketi
nyuma.
sentences:
- tai huruka
- mwanamume na mwanamke wenye mikoba
- Wanaume wawili wameketi karibu na mwanamke.
pipeline_tag: sentence-similarity
model-index:
- name: SentenceTransformer based on UBC-NLP/serengeti-E250
results:
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts test 768
type: sts-test-768
metrics:
- type: pearson_cosine
value: 0.7084016023985643
name: Pearson Cosine
- type: spearman_cosine
value: 0.7080643276583263
name: Spearman Cosine
- type: pearson_manhattan
value: 0.7163851544290831
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.7066259909380899
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.716171309296757
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.7064427148038006
name: Spearman Euclidean
- type: pearson_dot
value: 0.38463559218643695
name: Pearson Dot
- type: spearman_dot
value: 0.3566836293112297
name: Spearman Dot
- type: pearson_max
value: 0.7163851544290831
name: Pearson Max
- type: spearman_max
value: 0.7080643276583263
name: Spearman Max
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts test 512
type: sts-test-512
metrics:
- type: pearson_cosine
value: 0.7059523092716506
name: Pearson Cosine
- type: spearman_cosine
value: 0.7046582726338858
name: Spearman Cosine
- type: pearson_manhattan
value: 0.714245009590492
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.7048777976859945
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.7150194670982656
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.7055458365374757
name: Spearman Euclidean
- type: pearson_dot
value: 0.3855295554891442
name: Pearson Dot
- type: spearman_dot
value: 0.3585966097040326
name: Spearman Dot
- type: pearson_max
value: 0.7150194670982656
name: Pearson Max
- type: spearman_max
value: 0.7055458365374757
name: Spearman Max
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts test 256
type: sts-test-256
metrics:
- type: pearson_cosine
value: 0.7069259070512649
name: Pearson Cosine
- type: spearman_cosine
value: 0.7072103115498357
name: Spearman Cosine
- type: pearson_manhattan
value: 0.7151518946293685
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.7050845216566457
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.7154956682724514
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.70486417475867
name: Spearman Euclidean
- type: pearson_dot
value: 0.37291132473389677
name: Pearson Dot
- type: spearman_dot
value: 0.3480769113927452
name: Spearman Dot
- type: pearson_max
value: 0.7154956682724514
name: Pearson Max
- type: spearman_max
value: 0.7072103115498357
name: Spearman Max
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts test 128
type: sts-test-128
metrics:
- type: pearson_cosine
value: 0.7022542784280805
name: Pearson Cosine
- type: spearman_cosine
value: 0.7062378358777478
name: Spearman Cosine
- type: pearson_manhattan
value: 0.711575484251127
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.701312903814612
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.7125043324593673
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.7011154675785318
name: Spearman Euclidean
- type: pearson_dot
value: 0.34394993785114003
name: Pearson Dot
- type: spearman_dot
value: 0.31686351995727197
name: Spearman Dot
- type: pearson_max
value: 0.7125043324593673
name: Pearson Max
- type: spearman_max
value: 0.7062378358777478
name: Spearman Max
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts test 64
type: sts-test-64
metrics:
- type: pearson_cosine
value: 0.6950172826546709
name: Pearson Cosine
- type: spearman_cosine
value: 0.6993973161633343
name: Spearman Cosine
- type: pearson_manhattan
value: 0.7059726901866531
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.6938542774412633
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.7066346687971139
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.6949014564343952
name: Spearman Euclidean
- type: pearson_dot
value: 0.30982738809482646
name: Pearson Dot
- type: spearman_dot
value: 0.2855406388879541
name: Spearman Dot
- type: pearson_max
value: 0.7066346687971139
name: Pearson Max
- type: spearman_max
value: 0.6993973161633343
name: Spearman Max
---
# SentenceTransformer based on UBC-NLP/serengeti-E250
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [UBC-NLP/serengeti-E250](https://huggingface.co/UBC-NLP/serengeti-E250) on the Mollel/swahili-n_li-triplet-swh-eng dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
## Model Details
### Model Description
- **Model Type:** Sentence Transformer
- **Base model:** [UBC-NLP/serengeti-E250](https://huggingface.co/UBC-NLP/serengeti-E250)
- **Maximum Sequence Length:** 512 tokens
- **Output Dimensionality:** 768 tokens
- **Similarity Function:** Cosine Similarity
- **Training Dataset:**
- Mollel/swahili-n_li-triplet-swh-eng
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
### Full Model Architecture
```
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: ElectraModel
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)
```
## 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("sartifyllc/MultiLinguSwahili-MultiLinguSwahili-serengeti-E250-nli-matryoshka-nli-matryoshka")
# Run inference
sentences = [
'Mwanamume na mwanamke wachanga waliovaa mikoba wanaweka au kuondoa kitu kutoka kwenye mti mweupe wa zamani, huku watu wengine wamesimama au wameketi nyuma.',
'mwanamume na mwanamke wenye mikoba',
'tai huruka',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
```
## Evaluation
### Metrics
#### Semantic Similarity
* Dataset: `sts-test-768`
* Evaluated with [EmbeddingSimilarityEvaluator
](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| pearson_cosine | 0.7084 |
| **spearman_cosine** | **0.7081** |
| pearson_manhattan | 0.7164 |
| spearman_manhattan | 0.7066 |
| pearson_euclidean | 0.7162 |
| spearman_euclidean | 0.7064 |
| pearson_dot | 0.3846 |
| spearman_dot | 0.3567 |
| pearson_max | 0.7164 |
| spearman_max | 0.7081 |
#### Semantic Similarity
* Dataset: `sts-test-512`
* Evaluated with [EmbeddingSimilarityEvaluator
](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| pearson_cosine | 0.706 |
| **spearman_cosine** | **0.7047** |
| pearson_manhattan | 0.7142 |
| spearman_manhattan | 0.7049 |
| pearson_euclidean | 0.715 |
| spearman_euclidean | 0.7055 |
| pearson_dot | 0.3855 |
| spearman_dot | 0.3586 |
| pearson_max | 0.715 |
| spearman_max | 0.7055 |
#### Semantic Similarity
* Dataset: `sts-test-256`
* Evaluated with [EmbeddingSimilarityEvaluator
](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| pearson_cosine | 0.7069 |
| **spearman_cosine** | **0.7072** |
| pearson_manhattan | 0.7152 |
| spearman_manhattan | 0.7051 |
| pearson_euclidean | 0.7155 |
| spearman_euclidean | 0.7049 |
| pearson_dot | 0.3729 |
| spearman_dot | 0.3481 |
| pearson_max | 0.7155 |
| spearman_max | 0.7072 |
#### Semantic Similarity
* Dataset: `sts-test-128`
* Evaluated with [EmbeddingSimilarityEvaluator
](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| pearson_cosine | 0.7023 |
| **spearman_cosine** | **0.7062** |
| pearson_manhattan | 0.7116 |
| spearman_manhattan | 0.7013 |
| pearson_euclidean | 0.7125 |
| spearman_euclidean | 0.7011 |
| pearson_dot | 0.3439 |
| spearman_dot | 0.3169 |
| pearson_max | 0.7125 |
| spearman_max | 0.7062 |
#### Semantic Similarity
* Dataset: `sts-test-64`
* Evaluated with [EmbeddingSimilarityEvaluator
](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| pearson_cosine | 0.695 |
| **spearman_cosine** | **0.6994** |
| pearson_manhattan | 0.706 |
| spearman_manhattan | 0.6939 |
| pearson_euclidean | 0.7066 |
| spearman_euclidean | 0.6949 |
| pearson_dot | 0.3098 |
| spearman_dot | 0.2855 |
| pearson_max | 0.7066 |
| spearman_max | 0.6994 |
## Training Details
### Training Dataset
#### Mollel/swahili-n_li-triplet-swh-eng
* Dataset: Mollel/swahili-n_li-triplet-swh-eng
* Size: 1,115,700 training samples
* Columns: anchor
, positive
, and negative
* Approximate statistics based on the first 1000 samples:
| | anchor | positive | negative |
|:--------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
| type | string | string | string |
| details |
A person on a horse jumps over a broken down airplane.
| A person is outdoors, on a horse.
| A person is at a diner, ordering an omelette.
|
| Mtu aliyepanda farasi anaruka juu ya ndege iliyovunjika.
| Mtu yuko nje, juu ya farasi.
| Mtu yuko kwenye mkahawa, akiagiza omelette.
|
| Children smiling and waving at camera
| There are children present
| The kids are frowning
|
* Loss: [MatryoshkaLoss
](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#matryoshkaloss) with these parameters:
```json
{
"loss": "MultipleNegativesRankingLoss",
"matryoshka_dims": [
768,
512,
256,
128,
64
],
"matryoshka_weights": [
1,
1,
1,
1,
1
],
"n_dims_per_step": -1
}
```
### Evaluation Dataset
#### Mollel/swahili-n_li-triplet-swh-eng
* Dataset: Mollel/swahili-n_li-triplet-swh-eng
* Size: 13,168 evaluation samples
* Columns: anchor
, positive
, and negative
* Approximate statistics based on the first 1000 samples:
| | anchor | positive | negative |
|:--------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
| type | string | string | string |
| details | Two women are embracing while holding to go packages.
| Two woman are holding packages.
| The men are fighting outside a deli.
|
| Wanawake wawili wanakumbatiana huku wakishikilia vifurushi vya kwenda.
| Wanawake wawili wanashikilia vifurushi.
| Wanaume hao wanapigana nje ya duka la vyakula vitamu.
|
| Two young children in blue jerseys, one with the number 9 and one with the number 2 are standing on wooden steps in a bathroom and washing their hands in a sink.
| Two kids in numbered jerseys wash their hands.
| Two kids in jackets walk to school.
|
* Loss: [MatryoshkaLoss
](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#matryoshkaloss) with these parameters:
```json
{
"loss": "MultipleNegativesRankingLoss",
"matryoshka_dims": [
768,
512,
256,
128,
64
],
"matryoshka_weights": [
1,
1,
1,
1,
1
],
"n_dims_per_step": -1
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `per_device_train_batch_size`: 32
- `per_device_eval_batch_size`: 32
- `learning_rate`: 2e-05
- `num_train_epochs`: 1
- `warmup_ratio`: 0.1
- `bf16`: True
- `batch_sampler`: no_duplicates
#### All Hyperparameters