Downloads · 30 days
6
5% of all-time downloads
along26/distilroberta-base-manglish-sentence-transformer
distilroberta-base-manglish-sentence-transformer is a sentence similarity model from along26. Use it when you need a score for how close two texts are. It is set up for sentence-transformers.
This is a sentence-transformers model finetuned from sentence-transformers/all-MiniLM-L6-v2. It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for semantic textual similarity, sema…
Downloads · 30 days
6
5% of all-time downloads
All-time downloads
119
Public
Parameters
22.7M
90.9 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors90.9 MB · 99%
From the Hugging Face model README
This is a sentence-transformers model finetuned from sentence-transformers/all-MiniLM-L6-v2. It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
SentenceTransformer(
(0): Transformer({'max_seq_length': 256, 'do_lower_case': False, 'architecture': 'BertModel'})
(1): Pooling({'word_embedding_dimension': 384, '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})
(2): Normalize()
)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("along26/distilroberta-base-manglish-sentence-transformer")
# Run inference
sentences = [
"To construct a factor analysis model, we will follow these steps:\n\n1. Collect the data: In this case, we have the survey data from 50 students rating their satisfaction level on a scale of 1 to 10 for three aspects: academics (A), social life (S), and campus facilities (F).\n\n2. Create a correlation matrix: Calculate the correlation coefficients between each pair of variables (A, S, and F) using the collected data. The correlation matrix will look like this:\n\n```\n A S F\nA 1.000 r(A,S) r(A,F)\nS r(A,S) 1.000 r(S,F)\nF r(A,F) r(S,F) 1.000\n```\n\nwhere r(A,S), r(A,F), and r(S,F) are the correlation coefficients between academics and social life, academics and campus facilities, and social life and campus facilities, respectively.\n\n3. Determine the number of factors: To decide how many underlying factors can explain the correlations, we can use various methods, such as the Kaiser criterion (eigenvalues greater than 1), scree plot, or parallel analysis. For this example, let's use the Kaiser criterion.\n\n4. Extract the factors: Perform a factor analysis using a software or statistical tool (e.g., R, Python, SPSS) to extract the factors based on the chosen number of factors. The software will provide factor loadings, which represent the correlation between the original variables and the extracted factors.\n\n5. Interpret the factors: Analyze the factor loadings to understand the meaning of the extracted factors. If the loadings are high (e.g., greater than 0.5) for a particular variable, it means that the variable is strongly correlated with that factor.\n\nLet's assume we have calculated the correlation coefficients and performed the factor analysis. The results show that there is one underlying factor that explains the strong correlations between the three aspects (academics, social life, and campus facilities). This factor could be interpreted as the overall satisfaction with the college experience.\n\nIn conclusion, based on the factor analysis model, the three aspects of college experience (academics, social life, and campus facilities) are strongly correlated with each other, and one underlying factor can explain these correlations, which might represent the overall satisfaction with the college experience.",
'U',
'Suppose you have a dataset with 5 variables and you want to reduce the number of variables to 2. Using factor analysis, determine the two most important factors that explain the variation in the data. Include the factor loadings for each variable on each factor.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[ 1.0000, -1.0000, 1.0000],
# [-1.0000, 1.0000, -1.0000],
# [ 1.0000, -1.0000, 1.0000]])
<!--
### 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.*
-->
<!--
## 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.*
-->
| sentence_0 | sentence_1 | sentence_2 | |
|---|---|---|---|
| type | string | string | string |
| details | <ul><li>min: 9 tokens</li><li>mean: 150.71 tokens</li><li>max: 256 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 3.0 tokens</li><li>max: 3 tokens</li></ul> | <ul><li>min: 11 tokens</li><li>mean: 147.14 tokens</li><li>max: 256 tokens</li></ul> |
| sentence_0 | sentence_1 | sentence_2 |
|---|---|---|
| <code>Sebagai pengguna, saya ingin tahu sama ada terdapat sebarang usaha atau tindakan yang diambil oleh kerajaan atau badan kehakiman Malaysia untuk menangani kebimbangan ini tentang kadar perbicaraan yang perlahan dan meningkatkan kepercayaan orang ramai dalam proses tersebut?</code> | <code>E</code> | <code>Mengapa kadar perbicaraan dan prosiding undang-undang berkaitan 1MDB yang perlahan mencetuskan kekecewaan dan kritikan dalam kalangan rakyat Malaysia?</code> |
| <code>Pertama, mari kita layan 2 orang yang mesti duduk bersama sebagai satu unit. Jadi sekarang, kami mempunyai 4 unit untuk disusun (pasangan dan 3 individu yang lain).<br><br>Terdapat 4! (4 faktorial) cara menyusun 4 unit ini, iaitu 4! = 4 × 3 × 2 × 1 = 24 cara.<br><br>Kini, dalam pasangan itu, terdapat 2! (2 faktorial) cara untuk menyusun 2 orang, iaitu 2! = 2 × 1 = 2 cara.<br><br>Jadi, untuk mencari jumlah cara untuk menempatkan 5 orang, kita darabkan bilangan cara untuk menyusun 4 unit dengan bilangan cara untuk mengatur orang dalam pasangan:<br><br>Jumlah cara = 24 (susunan 4 unit) × 2 (susunan dalam pasangan) = 48 cara.</code> | <code>E</code> | <code>Apabila mengatur orang di sekitar meja bulat, kita biasanya menganggap satu orang sebagai titik rujukan untuk mengelakkan mengira susunan yang sama beberapa kali disebabkan oleh putaran. Oleh itu, kami mempunyai 7 orang kawan yang tinggal untuk mengatur meja.<br><br>Bilangan cara untuk mengatur 7 rakan ini ialah 7! (7 faktorial), iaitu:<br><br>7! = 7 × 6 × 5 × 4 × 3 × 2 × 1 = 5,040<br><br>Oleh itu, terdapat 5,040 cara yang berbeza untuk duduk 8 rakan di sekitar meja bulat.</code> |
| <code>How have Malaysia's international partners and institutions responded to the 1MDB scandal and Najib Razak's prosecution, and what impact has this had on the country's reputation and standing in the global community?</code> | <code>B</code> | <code>How has the international community responded to the 1MDB scandal and the allegations of corruption against Najib Razak, and what impact has this had on Malaysia's reputation as a whole?</code> |
{
"distance_metric": "TripletDistanceMetric.EUCLIDEAN",
"triplet_margin": 5
}
per_device_train_batch_size: 32per_device_eval_batch_size: 32multi_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 32per_device_eval_batch_size: 32per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_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: 3max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.0warmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Truesave_safetensors: Truesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseno_cuda: Falseuse_cpu: Falseuse_mps_device: Falseseed: 42data_seed: Nonejit_mode_eval: Falsebf16: Falsefp16: Falsefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: 0ddp_backend: Nonetpu_num_cores: Nonetpu_metrics_debug: Falsedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_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: Noneadafactor: Falsegroup_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: Trueuse_legacy_prediction_loop: Falsepush_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_inputs_for_metrics: Falseinclude_for_metrics: []eval_do_concat_batches: Truefp16_backend: autopush_to_hub_model_id: Nonepush_to_hub_organization: Nonemp_parameters:auto_find_batch_size: Falsefull_determinism: Falsetorchdynamo: Noneray_scope: lastddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_tokens_per_second: Falseinclude_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: Trueprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss |
|---|---|---|
| 0.0377 | 500 | 4.1322 |
| 0.0754 | 1000 | 3.2877 |
| 0.1131 | 1500 | 3.0609 |
| 0.1508 | 2000 | 3.047 |
| 0.1885 | 2500 | 3.0408 |
| 0.2262 | 3000 | 3.0383 |
| 0.2640 | 3500 | 3.0354 |
| 0.3017 | 4000 | 3.0329 |
| 0.3394 | 4500 | 3.0303 |
| 0.3771 | 5000 | 3.0269 |
| 0.4148 | 5500 | 3.023 |
| 0.4525 | 6000 | 3.0181 |
| 0.4902 | 6500 | 3.0128 |
| 0.5279 | 7000 | 3.0091 |
| 0.5656 | 7500 | 3.0066 |
| 0.6033 | 8000 | 3.0062 |
| 0.6410 | 8500 | 3.004 |
| 0.6787 | 9000 | 3.0032 |
| 0.7164 | 9500 | 3.0027 |
| 0.7541 | 10000 | 3.0022 |
| 0.7919 | 10500 | 3.0021 |
| 0.8296 | 11000 | 3.0016 |
| 0.8673 | 11500 | 3.0014 |
| 0.9050 | 12000 | 3.0012 |
| 0.9427 | 12500 | 3.001 |
| 0.9804 | 13000 | 3.0009 |
| 1.0181 | 13500 | 3.0008 |
| 1.0558 | 14000 | 3.0007 |
| 1.0935 | 14500 | 3.0011 |
| 1.1312 | 15000 | 3.0006 |
| 1.1689 | 15500 | 3.0005 |
| 1.2066 | 16000 | 3.0005 |
| 1.2443 | 16500 | 3.0004 |
| 1.2821 | 17000 | 3.0004 |
| 1.3198 | 17500 | 3.0004 |
| 1.3575 | 18000 | 3.0003 |
| 1.3952 | 18500 | 3.0003 |
| 1.4329 | 19000 | 3.0005 |
| 1.4706 | 19500 | 3.0003 |
| 1.5083 | 20000 | 3.0002 |
| 1.5460 | 20500 | 3.0002 |
| 1.5837 | 21000 | 3.0002 |
| 1.6214 | 21500 | 3.0002 |
| 1.6591 | 22000 | 3.0004 |
| 1.6968 | 22500 | 3.0002 |
| 1.7345 | 23000 | 3.0002 |
| 1.7722 | 23500 | 3.0001 |
| 1.8100 | 24000 | 3.0001 |
| 1.8477 | 24500 | 3.0001 |
| 1.8854 | 25000 | 3.0005 |
| 1.9231 | 25500 | 3.0001 |
| 1.9608 | 26000 | 3.0002 |
| 1.9985 | 26500 | 3.0002 |
| 2.0362 | 27000 | 3.0001 |
| 2.0739 | 27500 | 3.0001 |
| 2.1116 | 28000 | 3.0001 |
| 2.1493 | 28500 | 3.0001 |
| 2.1870 | 29000 | 3.0001 |
| 2.2247 | 29500 | 3.0001 |
| 2.2624 | 30000 | 3.0002 |
| 2.3002 | 30500 | 3.0001 |
| 2.3379 | 31000 | 3.0001 |
| 2.3756 | 31500 | 3.0001 |
| 2.4133 | 32000 | 3.0001 |
| 2.4510 | 32500 | 3.0001 |
| 2.4887 | 33000 | 3.0001 |
| 2.5264 | 33500 | 3.0001 |
| 2.5641 | 34000 | 3.0001 |
| 2.6018 | 34500 | 3.0001 |
| 2.6395 | 35000 | 3.0001 |
| 2.6772 | 35500 | 3.0003 |
| 2.7149 | 36000 | 3.0001 |
| 2.7526 | 36500 | 3.0001 |
| 2.7903 | 37000 | 3.0001 |
| 2.8281 | 37500 | 3.0003 |
| 2.8658 | 38000 | 3.0001 |
| 2.9035 | 38500 | 3.0001 |
| 2.9412 | 39000 | 3.0001 |
| 2.9789 | 39500 | 3.0001 |
@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",
}
@misc{hermans2017defense,
title={In Defense of the Triplet Loss for Person Re-Identification},
author={Alexander Hermans and Lucas Beyer and Bastian Leibe},
year={2017},
eprint={1703.07737},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
<!--
## 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.*
-->