---
language: []
library_name: sentence-transformers
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:1115700
- loss:MatryoshkaLoss
- loss:MultipleNegativesRankingLoss
base_model: Geotrend/bert-base-sw-cased
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 Geotrend/bert-base-sw-cased
results:
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts test 768
type: sts-test-768
metrics:
- type: pearson_cosine
value: 0.6937245827269046
name: Pearson Cosine
- type: spearman_cosine
value: 0.6872564222432196
name: Spearman Cosine
- type: pearson_manhattan
value: 0.6671541268726737
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.6578428252987948
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.6672292642346008
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.6577692881532263
name: Spearman Euclidean
- type: pearson_dot
value: 0.5234944445417878
name: Pearson Dot
- type: spearman_dot
value: 0.5126395384896926
name: Spearman Dot
- type: pearson_max
value: 0.6937245827269046
name: Pearson Max
- type: spearman_max
value: 0.6872564222432196
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.689885399601221
name: Pearson Cosine
- type: spearman_cosine
value: 0.6847071916895495
name: Spearman Cosine
- type: pearson_manhattan
value: 0.6678379220949281
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.6579957115799916
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.6673062843667007
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.6573006123381013
name: Spearman Euclidean
- type: pearson_dot
value: 0.49533316366864977
name: Pearson Dot
- type: spearman_dot
value: 0.48723679408818543
name: Spearman Dot
- type: pearson_max
value: 0.689885399601221
name: Pearson Max
- type: spearman_max
value: 0.6847071916895495
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.6873377612773459
name: Pearson Cosine
- type: spearman_cosine
value: 0.6816874105466478
name: Spearman Cosine
- type: pearson_manhattan
value: 0.667357515297651
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.6557727891191705
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.6674937201647584
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.6560441259953166
name: Spearman Euclidean
- type: pearson_dot
value: 0.45660372834373963
name: Pearson Dot
- type: spearman_dot
value: 0.4533070407260065
name: Spearman Dot
- type: pearson_max
value: 0.6873377612773459
name: Pearson Max
- type: spearman_max
value: 0.6816874105466478
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.6836009506667413
name: Pearson Cosine
- type: spearman_cosine
value: 0.6795423695973911
name: Spearman Cosine
- type: pearson_manhattan
value: 0.6663652896396122
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.6534731725514219
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.6663726876345561
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.6537216014002204
name: Spearman Euclidean
- type: pearson_dot
value: 0.43102957451470686
name: Pearson Dot
- type: spearman_dot
value: 0.431538008932168
name: Spearman Dot
- type: pearson_max
value: 0.6836009506667413
name: Pearson Max
- type: spearman_max
value: 0.6795423695973911
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.6715253560367674
name: Pearson Cosine
- type: spearman_cosine
value: 0.669070001537953
name: Spearman Cosine
- type: pearson_manhattan
value: 0.6571390159051358
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.6456119247619697
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.6598587843081631
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.6472279949159918
name: Spearman Euclidean
- type: pearson_dot
value: 0.36757468941627225
name: Pearson Dot
- type: spearman_dot
value: 0.3678274698380672
name: Spearman Dot
- type: pearson_max
value: 0.6715253560367674
name: Pearson Max
- type: spearman_max
value: 0.669070001537953
name: Spearman Max
---
# SentenceTransformer based on Geotrend/bert-base-sw-cased
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [Geotrend/bert-base-sw-cased](https://huggingface.co/Geotrend/bert-base-sw-cased) 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:** [Geotrend/bert-base-sw-cased](https://huggingface.co/Geotrend/bert-base-sw-cased)
- **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: BertModel
(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-bert-base-sw-cased-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.6937 |
| **spearman_cosine** | **0.6873** |
| pearson_manhattan | 0.6672 |
| spearman_manhattan | 0.6578 |
| pearson_euclidean | 0.6672 |
| spearman_euclidean | 0.6578 |
| pearson_dot | 0.5235 |
| spearman_dot | 0.5126 |
| pearson_max | 0.6937 |
| spearman_max | 0.6873 |
#### 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.6899 |
| **spearman_cosine** | **0.6847** |
| pearson_manhattan | 0.6678 |
| spearman_manhattan | 0.658 |
| pearson_euclidean | 0.6673 |
| spearman_euclidean | 0.6573 |
| pearson_dot | 0.4953 |
| spearman_dot | 0.4872 |
| pearson_max | 0.6899 |
| spearman_max | 0.6847 |
#### 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.6873 |
| **spearman_cosine** | **0.6817** |
| pearson_manhattan | 0.6674 |
| spearman_manhattan | 0.6558 |
| pearson_euclidean | 0.6675 |
| spearman_euclidean | 0.656 |
| pearson_dot | 0.4566 |
| spearman_dot | 0.4533 |
| pearson_max | 0.6873 |
| spearman_max | 0.6817 |
#### 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.6836 |
| **spearman_cosine** | **0.6795** |
| pearson_manhattan | 0.6664 |
| spearman_manhattan | 0.6535 |
| pearson_euclidean | 0.6664 |
| spearman_euclidean | 0.6537 |
| pearson_dot | 0.431 |
| spearman_dot | 0.4315 |
| pearson_max | 0.6836 |
| spearman_max | 0.6795 |
#### 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.6715 |
| **spearman_cosine** | **0.6691** |
| pearson_manhattan | 0.6571 |
| spearman_manhattan | 0.6456 |
| pearson_euclidean | 0.6599 |
| spearman_euclidean | 0.6472 |
| pearson_dot | 0.3676 |
| spearman_dot | 0.3678 |
| pearson_max | 0.6715 |
| spearman_max | 0.6691 |
## 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