along26/distilbert-base-manglish-sentence-transformer
SentenceTransformer based on sentence-transformers/all-MiniLM-L6-v2
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.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: sentence-transformers/all-MiniLM-L6-v2 <!-- at revision c9745ed1d9f207416be6d2e6f8de32d1f16199bf -->
- Maximum Sequence Length: 256 tokens
- Output Dimensionality: 384 dimensions
- Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
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()
)Usage
Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
pip install -U sentence-transformersThen you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("along26/distilbert-base-manglish-sentence-transformer")
# Run inference
sentences = [
'To find the shortest distance, we need to find the shortest path that visits all cities exactly once. We can use the brute force method to find all possible routes and then choose the shortest one.\n\nThere are 4! (factorial) possible routes since the salesman can start from City 1 and then visit the other cities in any order. 4! = 4 × 3 × 2 × 1 = 24 possible routes.\n\nHere are all the possible routes and their distances:\n\n1. 1-2-3-4-5: 10 + 8 + 14 + 16 = 48 km\n2. 1-2-3-5-4: 10 + 8 + 28 + 16 = 62 km\n3. 1-2-4-3-5: 10 + 25 + 14 + 28 = 77 km\n4. 1-2-4-5-3: 10 + 25 + 16 + 28 = 79 km\n5. 1-2-5-3-4: 10 + 18 + 14 + 14 = 56 km\n6. 1-2-5-4-3: 10 + 18 + 16 + 14 = 58 km\n7. 1-3-2-4-5: 15 + 8 + 25 + 16 = 64 km\n8. 1-3-2-5-4: 15 + 8 + 18 + 16 = 57 km\n9. 1-3-4-2-5: 15 + 14 + 25 + 18 = 72 km\n10. 1-3-4-5-2: 15 + 14 + 16 + 18 = 63 km\n11. 1-3-5-2-4: 15 + 28 + 18 + 25 = 86 km\n12. 1-3-5-4-2: 15 + 28 + 16 + 25 = 84 km\n13. 1-4-2-3-5: 12 + 8 + 14 + 28 = 62 km\n14. 1-4-2-5-3: 12 + 8 + 18 + 28 = 66 km\n15. 1-4-3-2-5: 12 + 14 + 8 + 18 = 52 km\n16. 1-4-3-5-2: 12 + 14 + 28 + 18 = 72 km\n17. 1-4-5-2-3: 12 + 16 + 18 + 8 = 54 km\n18. 1-4-5-3-2: 12 + 16 + 28 + 8 = 64 km\n19. 1-5-2-3-4: 20 + 18 + 14 + 14 = 66 km\n20. 1-5-2-4-3: 20 + 18 + 25 + 14 = 77 km\n21. 1-5-3-2-4: 20 + 28 + 8 + 25 = 81 km\n22. 1-5-3-4-2: 20 + 28 + 14 + 25 = 87 km\n23. 1-5-4-2-3: 20 + 16 + 25 + 8 = 69 km\n24. 1-5-4-3-2: 20 + 16 + 14 + 8 = 58 km\n\nThe shortest distance is 48 km, and the route is 1-2-3-4-5.',
'Wah, to find shortest distance ah, we need find shortest path that visit all city exactly once lah. Can use brute force method to find all possible route and then choose the shortest one lor.\n\nGot 4! (factorial) possible route since salesman can start from City 1 and then visit other city in any order. 4! = 4 × 3 × 2 × 1 = 24 possible route lah.\n\nHere all the possible route and their distance:\n\n1. 1-2-3-4-5: 10 + 8 + 14 + 16 = 48 km\n2. 1-2-3-5-4: 10 + 8 + 28 + 16 = 62 km\n3. 1-2-4-3-5: 10 + 25 + 14 + 28 = 77 km\n4. 1-2-4-5-3: 10 + 25 + 16 + 28 = 79 km\n5. 1-2-5-3-4: 10 + 18 + 14 + 14 = 56 km\n6. 1-2-5-4-3: 10 + 18 + 16 + 14 = 58 km\n7. 1-3-2-4-5: 15 + 8 + 25 + 16 = 64 km\n8. 1-3-2-5-4: 15 + 8 + 18 + 16 = 57 km\n9. 1-3-4-2-5: 15 + 14 + 25 + 18 = 72 km\n10. 1-3-4-5-2: 15 + 14 + 16 + 18 = 63 km\n11. 1-3-5-2-4: 15 + 28 + 18 + 25 = 86 km\n12. 1-3-5-4-2: 15 + 28 + 16 + 25 = 84 km\n13. 1-4-2-3-5: 12 + 8 + 14 + 28 = 62 km\n14. 1-4-2-5-3: 12 + 8 + 18 + 28 = 66 km\n15. 1-4-3-2-5: 12 + 14 + 8 + 18 = 52 km\n16. 1-4-3-5-2: 12 + 14 + 28 + 18 = 72 km\n17. 1-4-5-2-3: 12 + 16 + 18 + 8 = 54 km\n18. 1-4-5-3-2: 12 + 16 + 28 + 8 = 64 km\n19. 1-5-2-3-4: 20 + 18 + 14 + 14 = 66 km\n20. 1-5-2-4-3: 20 + 18 + 25 + 14 = 77 km\n21. 1-5-3-2-4: 20 + 28 + 8 + 25 = 81 km\n22. 1-5-3-4-2: 20 + 28 + 14 + 25 = 87 km\n23. 1-5-4-2-3: 20 + 16 + 25 + 8 = 69 km\n24. 1-5-4-3-2: 20 + 16 + 14 + 8 = 58 km\n\nThe shortest distance is 48 km, and the route is 1-2-3-4-5 lor.',
"Najib Razak's corruption trial has had a significant impact on Malaysia's political landscape and its fight against corruption. Najib, who served as Malaysia's Prime Minister from 2009 to 2018, has been on trial since 2019 on multiple charges of corruption, money laundering, and abuse of power related to the 1Malaysia Development Berhad (1MDB) scandal.\n\nThe 1MDB scandal involved the misappropriation of billions of dollars from a Malaysian state investment fund, and it has been described as one of the world's largest cases of financial misconduct. The scandal played a significant role in the ousting of Najib's ruling coalition, the Barisan Nasional, in the 2018 general election, which was won by the opposition alliance led by Mahathir Mohamad.\n\nNajib's corruption trial has been closely watched both domestically and internationally, as it represents a high-profile test of Malaysia's commitment to tackling corruption and upholding the rule of law. The trial has helped to raise public awareness of the issue of corruption in Malaysia and has put pressure on the government to take action against corrupt officials.\n\nThe trial has also had a significant impact on Malaysia's political landscape. Najib's United Malays National Organization (UMNO) party, which was once the dominant political force in the country, has been weakened by the scandal and the trial. The party was forced to leave the ruling coalition after Najib's election defeat, and it has struggled to regain its former influence.\n\nAt the same time, the trial has bolstered the credibility of the Malaysian Anti-Corruption Commission (MACC) and other anti-corruption agencies, which have been empowered to take on high-level cases of corruption. The MACC has reported an increase in the number of corruption cases reported since Najib's election defeat and the launch of his trial.\n\nIn summary, Najib Razak's corruption trial has been a significant milestone in Malaysia's fight against corruption, raising public awareness of the issue and bolstering the credibility of anti-corruption agencies. The trial has also had a profound impact on Malaysia's political landscape, weakening the influence of UMNO and highlighting the need for greater transparency and accountability in government.",
]
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. -->
Training Details
Training Dataset
Unnamed Dataset
- Size: 139,404 training samples
- Columns: <code>sentence0</code>, <code>sentence1</code>, and <code>sentence_2</code>
- Approximate statistics based on the first 1000 samples: | | sentence0 | sentence1 | sentence_2 | |:--------|:-------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 13 tokens</li><li>mean: 145.81 tokens</li><li>max: 256 tokens</li></ul> | <ul><li>min: 16 tokens</li><li>mean: 165.11 tokens</li><li>max: 256 tokens</li></ul> | <ul><li>min: 12 tokens</li><li>mean: 144.87 tokens</li><li>max: 256 tokens</li></ul> |
- Samples: | sentence0 | sentence1 | sentence2 | |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>The concentration of reactants plays a significant role in determining the rate and efficiency of a chemical reaction. According to the collision theory, a chemical reaction occurs when reactant particles collide with each other with sufficient energy and proper orientation. The rate of a chemical reaction depends on the frequency and effectiveness of these collisions.<br><br>Here's how the concentration of reactants affects the rate and efficiency of a chemical reaction:<br><br>1. Increased concentration of reactants: When the concentration of reactants is increased, there are more reactant particles per unit volume. This leads to a higher probability of collisions between reactant particles, resulting in an increased rate of reaction. In general, the rate of a reaction is directly proportional to the concentration of the reactants, as described by the rate law equation:<br><br>Rate = k[A]^m[B]^n<br><br>where Rate is the reaction rate, k is the rate constant, [A] and [B] are the concentrations of reactants A...</code> | <code>Kepekatan bahan tindak balas memainkan peranan penting dalam menentukan kadar dan kecekapan tindak balas kimia. Menurut teori perlanggaran, tindak balas kimia berlaku apabila zarah bahan tindak balas berlanggar antara satu sama lain dengan tenaga yang mencukupi dan orientasi yang betul. Kadar tindak balas kimia bergantung kepada kekerapan dan keberkesanan perlanggaran ini.<br><br>Begini cara kepekatan bahan tindak balas mempengaruhi kadar dan kecekapan tindak balas kimia:<br><br>1. Peningkatan kepekatan bahan tindak balas: Apabila kepekatan bahan tindak balas meningkat, terdapat lebih banyak zarah bahan tindak balas per unit isipadu. Ini membawa kepada kebarangkalian perlanggaran yang lebih tinggi antara zarah bahan tindak balas, mengakibatkan peningkatan kadar tindak balas. Secara umum, kadar tindak balas adalah berkadar terus dengan kepekatan bahan tindak balas, seperti yang diterangkan oleh persamaan undang-undang kadar:<br><br>Kadar = k[A]^m[B]^n<br><br>di mana Kadar ialah kadar tindak balas, k ialah pema...</code> | <code>Najib Razak, who served as the Prime Minister of Malaysia from 2009 to 2018, was known for his pro-business and pro-investment approach to foreign policy, which included strengthening Malaysia's ties with China. However, this approach also contributed to criticism from the left in Malaysia for several reasons.<br><br>Firstly, critics argued that Najib's emphasis on economic ties with China led to an over-reliance on Chinese investment, which could compromise Malaysia's sovereignty and independence. This concern was amplified by the fact that many of the Chinese-funded projects in Malaysia were mega-infrastructure projects, such as the East Coast Rail Link (ECRL) and the Bandar Malaysia development, which were financed through Chinese loans. Critics feared that Malaysia could be burdened with unsustainable debt levels, which could have long-term implications for the country's economic stability.<br><br>Secondly, the left in Malaysia raised concerns about the environmental impact of some of the Chin...</code> | | <code>To compute the Lie derivative of $X$ with respect to $Y$, we use the Lie bracket of vector fields, denoted by $[Y, X]$. The Lie bracket is defined as $[Y, X] = YX - XY$, where $YX$ and $XY$ denote the action of the vector fields $Y$ and $X$ on functions.<br><br>Let $f(x, y)$ and $g(x, y)$ be smooth functions on $M$. Then, we have<br><br>$X = (x^2 + 2y^2) \partialx + (x - 2y) \partialy$ and $Y = \partialx + \partialy$.<br><br>Now, we compute the Lie bracket $[Y, X]$:<br><br>$YX = Y((x^2 + 2y^2) \partialx + (x - 2y) \partialy) = Y((x^2 + 2y^2) \partialx) + Y((x - 2y) \partialy)$.<br><br>Using the product rule, we get<br><br>$YX = ((2x) \partialx + (4y) \partialy)(x^2 + 2y^2) \partialx + ((1) \partialx + (-2) \partialy)(x - 2y) \partialy$.<br><br>Now, we compute $XY$:<br><br>$XY = X(\partialx + \partialy) = X(\partialx) + X(\partialy)$.<br><br>Using the product rule, we get<br><br>$XY = ((x^2 + 2y^2) \partialx + (x - 2y) \partialy) \partialx + ((x^2 + 2y^2) \partialx + (x - 2y) \partialy) \partialy$.<br><br>Now, we compute the Li...</code> | <code>Untuk mengira terbitan Lie bagi $X$ berkenaan dengan $Y$, kami menggunakan kurungan Lie bagi medan vektor, dilambangkan dengan $[Y, X]$. Kurungan Lie ditakrifkan sebagai $[Y, X] = YX - XY$, di mana $YX$ dan $XY$ menandakan tindakan medan vektor $Y$ dan $X$ pada fungsi.<br><br>Biarkan $f(x, y)$ dan $g(x, y)$ menjadi fungsi lancar pada $M$. Kemudian, kita ada<br><br>$X = (x^2 + 2y^2) \partialx + (x - 2y) \partialy$ dan $Y = \partialx + \partialy$.<br><br>Sekarang, kita mengira kurungan Lie $[Y, X]$:<br><br>$YX = Y((x^2 + 2y^2) \partialx + (x - 2y) \partialy) = Y((x^2 + 2y^2) \partialx) + Y((x - 2y) \partialy )$.<br><br>Menggunakan peraturan produk, kita dapat<br><br>$YX = ((2x) \partialx + (4y) \partialy)(x^2 + 2y^2) \partialx + ((1) \partialx + (-2) \partialy)(x - 2y) \partialy$ .<br><br>Sekarang, kita mengira $XY$:<br><br>$XY = X(\partialx + \partialy) = X(\partialx) + X(\partialy)$.<br><br>Menggunakan peraturan produk, kita dapat<br><br>$XY = ((x^2 + 2y^2) \partialx + (x - 2y) \partialy) \partialx + ((x^2 + 2y^2) \partial_...</code> | <code>Ensuring fairness and impartiality in trials and appeals related to high-level corruption cases like the 1MDB scandal requires effective monitoring and oversight mechanisms to detect and address potential political interference. Here are some specific mechanisms that can be put in place, along with the entities responsible for implementing and overseeing them:<br><br>1. Judicial Commission: Establishing an independent judicial commission can provide oversight of the judiciary and investigate allegations of political interference. The commission could be responsible for reviewing judicial appointments, promotions, and disciplinary actions, and for recommending reforms to promote judicial independence. This commission should be composed of respected legal experts, civil society representatives, and other stakeholders, and should be independent from the government and political influence.<br>2. Anti-corruption agency: A dedicated anti-corruption agency can investigate allegations of corruption and...</code> | | <code>What is the reaction mechanism for the acid-catalyzed cleavage of an ether? Provide the step-by-step process and the structures of the intermediate compounds involved in the reaction.</code> | <code>Apakah mekanisme tindak balas bagi pembelahan bermangkin asid bagi eter? Sediakan proses langkah demi langkah dan struktur sebatian perantaraan yang terlibat dalam tindak balas.</code> | <code>Political funding in Malaysia has been criticized for being opaque and vulnerable to corruption due to several reasons. Firstly, there is a lack of transparency in the way political parties raise and spend their funds. Many political donations are made in cash, and there is no requirement for parties to disclose the source of their donations. This lack of transparency creates an environment that is conducive to corruption, as it allows politicians to accept illicit funds without being held accountable.<br><br>Secondly, there are no limits on the amount of money that political parties can receive from donors. This has led to concerns that wealthy individuals or corporations may use their financial influence to gain favorable policies or access to decision-makers. In some cases, political donations have been linked to corrupt practices such as cronyism and patronage.<br><br>Thirdly, the enforcement of laws related to political funding is weak. The Malaysian Anti-Corruption Commission (MACC) has limi...</code> |
- Loss: <code>TripletLoss</code> with these parameters:
{
"distance_metric": "TripletDistanceMetric.EUCLIDEAN",
"triplet_margin": 5
}Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size: 32per_device_eval_batch_size: 32multi_dataset_batch_sampler: round_robin
All Hyperparameters
<details><summary>Click to expand</summary>
overwrite_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: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamwtorchfusedoptim_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: {}
</details>
Training Logs
Framework Versions
- Python: 3.12.12
- Sentence Transformers: 5.1.2
- Transformers: 4.57.1
- PyTorch: 2.8.0+cu126
- Accelerate: 1.11.0
- Datasets: 4.0.0
- Tokenizers: 0.22.1
Citation
BibTeX
Sentence Transformers
@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",
}TripletLoss
@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. -->
