CoolFace
Modelpublic

Mollel/swahili-gte-base-en-v1.5-nli-matryoshka

sourceHugging Faceupdated 2y agoView on Hugging Face
1likes26downloads
Model Card

SentenceTransformer based on Alibaba-NLP/gte-base-en-v1.5

This is a sentence-transformers model finetuned from Alibaba-NLP/gte-base-en-v1.5. 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: Alibaba-NLP/gte-base-en-v1.5 <!-- at revision 269b9aca14a582d83e31b8c76b2e85a266fc1d77 -->
  • —Maximum Sequence Length: 8192 tokens
  • —Output Dimensionality: 768 tokens
  • —Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: NewModel 
  (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, '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("Mollel/swahili-gte-base-en-v1.5-nli-matryoshka")
# Run inference
sentences = [
    'Mwanamume aliyevalia koti la bluu la kuzuia upepo, amelala uso chini kwenye benchi ya bustani, akiwa na chupa ya pombe iliyofungwa kwenye mojawapo ya miguu ya benchi.',
    'Mwanamume amelala uso chini kwenye benchi ya bustani.',
    'Mwanamume fulani anacheza dansi kwenye klabu hiyo akifungua chupa.',
]
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]

<!--

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. -->

Evaluation

Metrics

Semantic Similarity
MetricValue
pearson_cosine0.7043
spearman_cosine0.6964
pearson_manhattan0.6909
spearman_manhattan0.6919
pearson_euclidean0.6929
spearman_euclidean0.6938
pearson_dot0.7012
spearman_dot0.6918
pearson_max0.7043
spearman_max0.6964
Semantic Similarity
MetricValue
pearson_cosine0.7024
spearman_cosine0.6961
pearson_manhattan0.6937
spearman_manhattan0.6943
pearson_euclidean0.6959
spearman_euclidean0.6965
pearson_dot0.674
spearman_dot0.6636
pearson_max0.7024
spearman_max0.6965
Semantic Similarity
MetricValue
pearson_cosine0.6976
spearman_cosine0.6922
pearson_manhattan0.7013
spearman_manhattan0.7002
pearson_euclidean0.7033
spearman_euclidean0.7028
pearson_dot0.6354
spearman_dot0.6242
pearson_max0.7033
spearman_max0.7028
Semantic Similarity
MetricValue
pearson_cosine0.691
spearman_cosine0.688
pearson_manhattan0.7045
spearman_manhattan0.7001
pearson_euclidean0.7064
spearman_euclidean0.7029
pearson_dot0.5847
spearman_dot0.5729
pearson_max0.7064
spearman_max0.7029
Semantic Similarity
MetricValue
pearson_cosine0.681
spearman_cosine0.6803
pearson_manhattan0.7053
spearman_manhattan0.6987
pearson_euclidean0.7061
spearman_euclidean0.7004
pearson_dot0.5177
spearman_dot0.502
pearson_max0.7061
spearman_max0.7004

<!--

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 Hyperparameters

Non-Default Hyperparameters
  • —num_train_epochs: 1
  • —warmup_ratio: 0.1
  • —fp16: True
  • —batch_sampler: no_duplicates
All Hyperparameters

<details><summary>Click to expand</summary>

  • —overwrite_output_dir: False
  • —do_predict: False
  • —prediction_loss_only: True
  • —per_device_train_batch_size: 8
  • —per_device_eval_batch_size: 8
  • —per_gpu_train_batch_size: None
  • —per_gpu_eval_batch_size: None
  • —gradient_accumulation_steps: 1
  • —eval_accumulation_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.0
  • —num_train_epochs: 1
  • —max_steps: -1
  • —lr_scheduler_type: linear
  • —lr_scheduler_kwargs: {}
  • —warmup_ratio: 0.1
  • —warmup_steps: 0
  • —log_level: passive
  • —log_level_replica: warning
  • —log_on_each_node: True
  • —logging_nan_inf_filter: True
  • —save_safetensors: True
  • —save_on_each_node: False
  • —save_only_model: False
  • —no_cuda: False
  • —use_cpu: False
  • —use_mps_device: False
  • —seed: 42
  • —data_seed: None
  • —jit_mode_eval: False
  • —use_ipex: False
  • —bf16: False
  • —fp16: True
  • —fp16_opt_level: O1
  • —half_precision_backend: auto
  • —bf16_full_eval: False
  • —fp16_full_eval: False
  • —tf32: None
  • —local_rank: 0
  • —ddp_backend: None
  • —tpu_num_cores: None
  • —tpu_metrics_debug: False
  • —debug: []
  • —dataloader_drop_last: False
  • —dataloader_num_workers: 0
  • —dataloader_prefetch_factor: None
  • —past_index: -1
  • —disable_tqdm: False
  • —remove_unused_columns: True
  • —label_names: None
  • —load_best_model_at_end: False
  • —ignore_data_skip: False
  • —fsdp: []
  • —fsdp_min_num_params: 0
  • —fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • —fsdp_transformer_layer_cls_to_wrap: None
  • —accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'gradientaccumulation_kwargs': None}
  • —deepspeed: None
  • —label_smoothing_factor: 0.0
  • —optim: adamw_torch
  • —optim_args: None
  • —adafactor: False
  • —group_by_length: False
  • —length_column_name: length
  • —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
  • —use_legacy_prediction_loop: False
  • —push_to_hub: False
  • —resume_from_checkpoint: None
  • —hub_model_id: None
  • —hub_strategy: every_save
  • —hub_private_repo: False
  • —hub_always_push: False
  • —gradient_checkpointing: False
  • —gradient_checkpointing_kwargs: None
  • —include_inputs_for_metrics: False
  • —eval_do_concat_batches: True
  • —fp16_backend: auto
  • —push_to_hub_model_id: None
  • —push_to_hub_organization: None
  • —mp_parameters:
  • —auto_find_batch_size: False
  • —full_determinism: False
  • —torchdynamo: None
  • —ray_scope: last
  • —ddp_timeout: 1800
  • —torch_compile: False
  • —torch_compile_backend: None
  • —torch_compile_mode: None
  • —dispatch_batches: None
  • —split_batches: None
  • —include_tokens_per_second: False
  • —include_num_input_tokens_seen: False
  • —neftune_noise_alpha: None
  • —optim_target_modules: None
  • —batch_sampler: no_duplicates
  • —multi_dataset_batch_sampler: proportional

</details>

Training Logs

<details><summary>Click to expand</summary>

EpochStepTraining Losssts-test-128_spearman_cosinests-test-256_spearman_cosinests-test-512_spearman_cosinests-test-64_spearman_cosinests-test-768_spearman_cosine
0.002910013.2716-----
0.00572009.83-----
0.00863009.9047-----
0.01154007.5137-----
0.01435007.6419-----
0.01726006.9603-----
0.02017007.3009-----
0.02298007.1397-----
0.02589008.1352-----
0.028710007.5945-----
0.031511007.0476-----
0.034412005.3356-----
0.037313005.1529-----
0.040214004.9726-----
0.043015005.1683-----
0.045916004.7945-----
0.048817004.9624-----
0.051618004.4254-----
0.054519004.4379-----
0.057420004.0327-----
0.060221003.5138-----
0.063122004.5055-----
0.066023003.8966-----
0.068824004.4884-----
0.071725003.5825-----
0.074626004.0155-----
0.077427004.9842-----
0.080328004.7732-----
0.083229004.5095-----
0.086030004.2526-----
0.088931004.033-----
0.091832004.0052-----
0.094633003.197-----
0.097534003.3423-----
0.100435002.9528-----
0.103336003.9315-----
0.106137003.7733-----
0.109038003.5153-----
0.111939004.1326-----
0.114740005.2179-----
0.117641006.4314-----
0.120542006.3485-----
0.123343004.7771-----
0.126244004.9055-----
0.129145003.9025-----
0.131946004.4638-----
0.134847005.0049-----
0.137748004.3124-----
0.140549004.0027-----
0.143450004.3173-----
0.146351003.6629-----
0.149152004.2759-----
0.152053003.4621-----
0.154954003.9251-----
0.157755004.2294-----
0.160656003.6244-----
0.163557004.283-----
0.166458004.4665-----
0.169259004.956-----
0.172160004.795-----
0.175061004.998-----
0.177862005.3316-----
0.180763005.2247-----
0.183664004.6554-----
0.186465005.2474-----
0.189366005.1168-----
0.192267005.1372-----
0.195068004.1564-----
0.197969004.6997-----
0.200870004.1854-----
0.203671004.4574-----
0.206572004.1859-----
0.209473004.8306-----
0.212274004.4487-----
0.215175004.4606-----
0.218076004.4222-----
0.220877004.7836-----
0.223778004.1475-----
0.226679005.1679-----
0.229480005.0106-----
0.232381004.1899-----
0.235282004.9873-----
0.238183004.3656-----
0.240984004.6117-----
0.243885004.1785-----
0.246786003.7809-----
0.249587004.9116-----
0.252488004.553-----
0.255389004.3178-----
0.258190005.6111-----
0.261091005.4219-----
0.263992005.5628-----
0.266793004.4221-----
0.269694004.7988-----
0.272595004.9361-----
0.275396004.7225-----
0.278297004.7258-----
0.281198004.7071-----
0.283999004.5519-----
0.2868100004.5354-----
0.2897101004.3893-----
0.2925102004.7848-----
0.2954103004.7195-----
0.2983104004.0155-----
0.3012105005.1602-----
0.3040106004.6345-----
0.3069107005.39-----
0.3098108004.7974-----
0.3126109004.9736-----
0.3155110005.0949-----
0.3184111004.6704-----
0.3212112004.7001-----
0.3241113004.2913-----
0.3270114004.7536-----
0.3298115004.8349-----
0.3327116004.2567-----
0.3356117004.6754-----
0.3384118004.8534-----
0.3413119004.7486-----
0.3442120004.9194-----
0.3470121004.4572-----
0.3499122004.6173-----
0.3528123005.1292-----
0.3556124004.6138-----
0.3585125004.6884-----
0.3614126004.4245-----
0.3643127004.7534-----
0.3671128004.7027-----
0.3700129004.5186-----
0.3729130003.8917-----
0.3757131004.507-----
0.3786132005.4866-----
0.3815133004.0424-----
0.3843134004.4017-----
0.3872135004.0016-----
0.3901136004.0695-----
0.3929137004.4957-----
0.3958138004.4655-----
0.3987139004.5717-----
0.4015140004.134-----
0.4044141004.2704-----
0.4073142004.7712-----
0.4101143004.3946-----
0.4130144004.5848-----
0.4159145004.4655-----
0.4187146004.278-----
0.4216147004.2877-----
0.4245148003.9299-----
0.4274149004.7078-----
0.4302150004.8527-----
0.4331151004.3476-----
0.4360152004.2012-----
0.4388153004.1766-----
0.4417154003.9842-----
0.4446155004.1244-----
0.4474156004.7983-----
0.4503157004.2341-----
0.4532158004.9829-----
0.4560159004.0221-----
0.4589160004.1082-----
0.4618161003.8922-----
0.4646162004.5382-----
0.4675163004.4428-----
0.4704164003.9087-----
0.4732165003.7465-----
0.4761166004.149-----
0.4790167004.5691-----
0.4818168003.8776-----
0.4847169003.7354-----
0.4876170004.25-----
0.4904171004.4119-----
0.4933172004.2319-----
0.4962173004.3736-----
0.4991174004.5345-----
0.5019175004.1824-----
0.5048176004.0033-----
0.5077177004.277-----
0.5105178004.3553-----
0.5134179003.9528-----
0.5163180004.068-----
0.5191181004.0464-----
0.5220182004.1665-----
0.5249183003.7445-----
0.5277184004.2248-----
0.5306185003.9295-----
0.5335186003.546-----
0.5363187003.7463-----
0.5392188003.9798-----
0.5421189004.4773-----
0.5449190004.3534-----
0.5478191004.2347-----
0.5507192003.8113-----
0.5535193004.4689-----
0.5564194004.2188-----
0.5593195004.1266-----
0.5622196003.9222-----
0.5650197004.38-----
0.5679198004.4557-----
0.5708199004.7566-----
0.5736200003.8922-----
0.5765201004.0263-----
0.5794202003.9258-----
0.5822203004.3767-----
0.5851204004.1211-----
0.5880205004.3083-----
0.5908206004.4544-----
0.5937207004.0118-----
0.5966208003.9136-----
0.5994209003.8614-----
0.6023210003.8057-----
0.6052211004.4934-----
0.6080212003.9206-----
0.6109213004.43-----
0.6138214004.0576-----
0.6166215003.9019-----
0.6195216004.4216-----
0.6224217004.0959-----
0.6253218003.8756-----
0.6281219004.7791-----
0.6310220003.6284-----
0.6339221004.5534-----
0.6367222004.18-----
0.6396223004.3002-----
0.6425224003.7162-----
0.6453225004.8495-----
0.6482226004.2966-----
0.6511227003.7718-----
0.6539228004.2257-----
0.6568229003.9821-----
0.6597230004.0853-----
0.6625231003.6124-----
0.6654232003.732-----
0.6683233004.3821-----
0.6711234004.229-----
0.6740235004.2589-----
0.6769236004.4975-----
0.6797237003.8062-----
0.6826238003.6924-----
0.6855239003.7736-----
0.6883240003.7815-----
0.6912241004.1192-----
0.6941242004.2336-----
0.6970243004.1145-----
0.6998244004.0681-----
0.7027245004.0492-----
0.7056246003.7831-----
0.7084247004.2445-----
0.7113248003.9308-----
0.7142249003.8705-----
0.7170250003.6998-----
0.7199251003.4736-----
0.7228252003.9971-----
0.7256253003.8292-----
0.7285254003.8499-----
0.7314255003.8732-----
0.7342256003.9409-----
0.7371257004.4416-----
0.7400258003.663-----
0.7428259003.9786-----
0.7457260004.1781-----
0.7486261003.692-----
0.7514262003.2601-----
0.7543263007.1759-----
0.7572264007.0459-----
0.7601265006.1797-----
0.7629266006.2055-----
0.7658267006.1403-----
0.7687268005.703-----
0.7715269006.1283-----
0.7744270005.71-----
0.7773271005.3105-----
0.7801272005.4202-----
0.7830273005.2964-----
0.7859274005.4852-----
0.7887275005.241-----
0.7916276005.4322-----
0.7945277005.6285-----
0.7973278005.0215-----
0.8002279005.2433-----
0.8031280004.9617-----
0.8059281004.9479-----
0.8088282004.9077-----
0.8117283004.853-----
0.8145284004.6727-----
0.8174285004.9987-----
0.8203286004.8405-----
0.8232287004.9627-----
0.8260288004.5608-----
0.8289289005.0802-----
0.8318290004.9069-----
0.8346291004.8605-----
0.8375292004.6424-----
0.8404293004.7813-----
0.8432294004.5925-----
0.8461295004.7081-----
0.8490296004.4319-----
0.8518297004.7291-----
0.8547298004.749-----
0.8576299004.6148-----
0.8604300004.2549-----
0.8633301004.3415-----
0.8662302004.1999-----
0.8690303004.4298-----
0.8719304004.3612-----
0.8748305004.4834-----
0.8776306004.4774-----
0.8805307004.2524-----
0.8834308004.5562-----
0.8863309004.5261-----
0.8891310004.0262-----
0.8920311004.1109-----
0.8949312004.1955-----
0.8977313004.3169-----
0.9006314004.5862-----
0.9035315004.5503-----
0.9063316004.2587-----
0.9092317004.0028-----
0.9121318004.3575-----
0.9149319004.1033-----
0.9178320004.2877-----
0.9207321003.9537-----
0.9235322004.107-----
0.9264323004.3288-----
0.9293324004.102-----
0.9321325004.1751-----
0.9350326003.7919-----
0.9379327004.0939-----
0.9407328004.1822-----
0.9436329003.959-----
0.9465330003.9173-----
0.9493331004.3087-----
0.9522332004.1239-----
0.9551333004.1012-----
0.9580334003.9988-----
0.9608335004.1478-----
0.9637336004.1669-----
0.9666337004.0398-----
0.9694338003.9814-----
0.9723339004.3764-----
0.9752340004.2847-----
0.9780341003.9461-----
0.9809342004.3377-----
0.9838343003.8114-----
0.9866344004.0827-----
0.9895345004.0014-----
0.9924346004.3964-----
0.9952347003.9103-----
0.9981348004.0363-----
1.034866-0.68800.69220.69610.68030.6964

</details>

Framework Versions

  • —Python: 3.11.9
  • —Sentence Transformers: 3.0.1
  • —Transformers: 4.40.1
  • —PyTorch: 2.3.0+cu121
  • —Accelerate: 0.29.3
  • —Datasets: 2.19.0
  • —Tokenizers: 0.19.1

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",
}
MatryoshkaLoss
bibtex
@misc{kusupati2024matryoshka,
    title={Matryoshka Representation Learning}, 
    author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
    year={2024},
    eprint={2205.13147},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}
MultipleNegativesRankingLoss
bibtex
@misc{henderson2017efficient,
    title={Efficient Natural Language Response Suggestion for Smart Reply}, 
    author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
    year={2017},
    eprint={1705.00652},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}

<!--

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. -->