Sentence Similarity
sentence-transformers
Safetensors
Burmese
bert
feature-extraction
dense
Generated from Trainer
myanmar
burmese
nlp
text-embeddings-inference
Instructions to use DatarrX/myX-Semantic with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use DatarrX/myX-Semantic with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("DatarrX/myX-Semantic") sentences = [ "▁ထို အလုပ်ရုံ သည် ▁ကျနော် ၏ ▁ကိုယ်ရေး အချက်အလက် များကို ဖတ်ရှု ကာ ▁မေးခွန်းများ ▁မေး ကာ ▁ကျနော့်ကို ▁ဝယ် လိုက်ပါတော့သည်။", "▁ထုံးတမ်းစဉ်လာ ▁လေး ပါး တွင် ▁ကံ ▁၊ ▁တရား ▁၊ ▁သ မ် စာ ▁၊ ▁မော သံ ▁နှင့် ▁ယောဂ ▁အမျိုးအစား ▁အမျိုးမျိုး တို့ ▁ပါဝင် သည်။", "▁ကိုယ်ပိုင် ဟန် ၊ ▁ကိုယ်ပိုင် ဒီဇိုင်း ၊ ▁ကိုယ်ပိုင် စိတ်ကူး ၊ ▁ကိုယ်ပိုင် ဖန်တီး မှုကို ▁ပြသ သည့် ▁ဝတ်စုံ များကို ▁ဒီဇိုင်နာ ▁မ မီး မီး က ▁ပန်းချီကား တစ်ချပ် သဖွယ် ▁ဖန်တီး သူဖြစ်သည်။" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -2,149 +2,148 @@
|
|
| 2 |
license: apache-2.0
|
| 3 |
language:
|
| 4 |
- my
|
| 5 |
-
pipeline_tag:
|
| 6 |
tags:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
- myanmar
|
| 8 |
- burmese
|
| 9 |
- nlp
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
datasets:
|
| 15 |
- DatarrX/myX-Mega-Corpus
|
| 16 |
---
|
| 17 |
|
| 18 |
-
# myX-Semantic: A
|
| 19 |
-
|
| 20 |
-
##
|
| 21 |
-
**myX-Semantic**
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
*
|
| 29 |
-
*
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
*
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
## ၆။ အသုံးပြုနည်း လမ်းညွှန် (How to Use)
|
| 53 |
-
ဤ Model ကို Python environment တွင် အောက်ပါအဆင့်များအတိုင်း အသုံးပြုနိုင်သည်။
|
| 54 |
-
|
| 55 |
-
### ၆.၁ လိုအပ်သော Library များ ထည့်သွင်းခြင်း (Installation)
|
| 56 |
-
|
| 57 |
-
ပထမဦးစွာ Model ကို Load လုပ်ရန်နှင့် Hugging Face မှ Download ရယူရန် လိုအပ်သော Library များကို Install လုပ်ပါ။
|
| 58 |
-
```BASH
|
| 59 |
-
pip install fasttext huggingface_hub
|
| 60 |
```
|
| 61 |
-
### ၆.၂ Model ကို Load လုပ်ခြင်း (Loading the Model)
|
| 62 |
|
| 63 |
-
|
| 64 |
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
# Hugging Face မှ model ဖိုင်ကို download ဆွဲခြင်း
|
| 70 |
-
model_path = hf_hub_download(repo_id="DatarrX/myX-Semantic", filename="myX-Semantic.bin")
|
| 71 |
-
|
| 72 |
-
# fasttext ကို သုံးပြီး model ကို load လုပ်ခြင်း
|
| 73 |
-
model = fasttext.load_model(model_path)
|
| 74 |
-
```
|
| 75 |
-
### ၆.၃ အခြေခံ အသုံးပြုနည်းများ (Basic Operations)
|
| 76 |
-
Model ရရှိပြီးနောက် အောက်ပါ NLP လုပ်ငန်းစဉ်များကို စမ်းသပ်နိုင်သည်။
|
| 77 |
-
|
| 78 |
-
- က) အဓိပ္ပာယ်တူညီသော စကားလုံးများ ရှာဖွေခြင်း (Finding Nearest Neighbors)
|
| 79 |
-
စကားလုံးတစ်လုံးနှင့် အနီးစပ်ဆုံး အဓိပ္ပာယ်ရှိသော စကားလုံး (၁၀) လုံးကို ရှာဖွေရန်:
|
| 80 |
-
|
| 81 |
-
```Python
|
| 82 |
-
# 'နည်းပညာ' နှင့် အနီးစပ်ဆုံးစကားလုံးများ ရှာခြင်း
|
| 83 |
-
neighbors = model.get_nearest_neighbors("နည်းပညာ")
|
| 84 |
-
for score, neighbor in neighbors:
|
| 85 |
-
print(f"{neighbor}: {score:.4f}")
|
| 86 |
```
|
| 87 |
-
- ခ) စကားလုံးနှစ်လုံး၏ အဓိပ္ပာယ် နီးစပ်မှုကို စစ်ဆေးခြင်း (Calculating Similarity Score)
|
| 88 |
-
စကားလုံးနှစ်လုံးသည် အဓိပ္ပာယ်အရ မည်မျှ နီးစပ်သလဲဆိုသည်ကို တွက်ချက်ရန်:
|
| 89 |
|
| 90 |
-
|
| 91 |
-
|
|
|
|
| 92 |
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
v2 = model.get_word_vector(w2)
|
| 96 |
-
return np.dot(v1, v2) / (np.linalg.norm(v1) * np.linalg.norm(v2))
|
| 97 |
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
-
|
| 103 |
-
|
| 104 |
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
print(
|
| 108 |
```
|
| 109 |
|
| 110 |
-
##
|
| 111 |
-
|
| 112 |
-
* **အဆင့် (၁) - Tokenization:** [myX-Tokenizer](https://huggingface.co/DatarrX/myX-Tokenizer) ကို အသုံးပြု၍ ၁၆ သန်းကျော်သော စာကြောင်းများကို Subword units များအဖြစ် ခွဲခြားခဲ့သည်။ လုပ်ဆောင်ချက် မြန်ဆန်စေရန် Multiprocessing စနစ်ကို အသုံးပြုခဲ့သည်။
|
| 113 |
-
* **အဆင့် (၂) - FastText Training:** ခွဲခြားထားသော Token များကို FastText (Skip-gram) algorithm သုံး၍ Dimension 100 ဖြင့် လေ့ကျင့်ခဲ့သည်။ ပိုမိုတိကျသော Context များရရှိရန် Window Size 5 နှင့် Negative Sampling နည်းလမ်းကို အသုံးပြုခဲ့သည်။
|
| 114 |
-
|
| 115 |
-
## ၈။ လေ့ကျင့်မှုဆိုင်ရာ ကုဒ်များ (Training Code)
|
| 116 |
-
မော်ဒယ်အား ပြန်လည်စမ်းသပ်နိုင်ရန်နှင့် ပွင့်လင်းမြင်သာမှုရှိစေရန်အတွက် အသုံးပြ��ခဲ့သော ကုဒ်အပြည့်အစုံကို အောက်ပါ GitHub link တွင် လေ့လာနိုင်သည် -
|
| 117 |
-
👉 [https://github.com/DatarrX/myX-Semantic](https://github.com/DatarrX/myX-Semantic)
|
| 118 |
|
| 119 |
-
|
| 120 |
-
*
|
| 121 |
-
* **File Format:** Binary (.bin)
|
| 122 |
-
* **File Size:** ~851.71 MB
|
| 123 |
-
* **Vector Dimension:** 100
|
| 124 |
-
* **Architecture:** FastText (Skip-gram)
|
| 125 |
|
| 126 |
-
##
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
-
##
|
| 130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
|
| 132 |
-
##
|
|
|
|
|
|
|
| 133 |
|
| 134 |
-
|
|
|
|
| 135 |
|
| 136 |
-
##
|
|
|
|
| 137 |
```bibtex
|
| 138 |
@software{khantsintheinn2026myxsemantic,
|
| 139 |
author = {Khant Sint Heinn},
|
| 140 |
-
title = {myX-Semantic: A Burmese
|
| 141 |
year = {2026},
|
| 142 |
publisher = {DatarrX},
|
| 143 |
-
url = {https://huggingface.co/DatarrX/myX-Semantic}
|
| 144 |
-
note = {Myanmar Open Source NGO}
|
| 145 |
}
|
| 146 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
|
| 148 |
-
|
| 149 |
|
| 150 |
-
|
|
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
language:
|
| 4 |
- my
|
| 5 |
+
pipeline_tag: sentence-similarity
|
| 6 |
tags:
|
| 7 |
+
- sentence-transformers
|
| 8 |
+
- sentence-similarity
|
| 9 |
+
- feature-extraction
|
| 10 |
+
- dense
|
| 11 |
+
- generated_from_trainer
|
| 12 |
- myanmar
|
| 13 |
- burmese
|
| 14 |
- nlp
|
| 15 |
+
library_name: sentence-transformers
|
| 16 |
+
dataset_size: 1000000
|
| 17 |
+
loss: MSELoss
|
| 18 |
+
base_model: sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2
|
| 19 |
+
widget:
|
| 20 |
+
- source_sentence: >-
|
| 21 |
+
▁ထို အလုပ်ရုံ သည် ▁ကျနော် ၏ ▁ကိုယ်ရေး အချက်အလက် များကို ဖတ်ရှု ကာ
|
| 22 |
+
▁မေးခွန်းများ ▁မေး ကာ ▁ကျနော့်ကို ▁ဝယ် လိုက်ပါတော့သည်။
|
| 23 |
+
sentences:
|
| 24 |
+
- >-
|
| 25 |
+
▁ထုံးတမ်းစဉ်လာ ▁လေး ပါး တွင် ▁ကံ ▁၊ ▁တရား ▁၊ ▁သ မ် စာ ▁၊ ▁မော သံ ▁နှင့်
|
| 26 |
+
▁ယောဂ ▁အမျိုးအစား ▁အမျိုးမျိုး တို့ ▁ပါဝင် သည်။
|
| 27 |
+
- >-
|
| 28 |
+
▁ကိုယ်ပိုင် ဟန် ၊ ▁ကိုယ်ပိုင် ဒီဇိုင်း ၊ ▁ကိုယ်ပိုင် စိတ်ကူး ၊ ▁ကိုယ်ပိုင်
|
| 29 |
+
ဖန်တီး မှုကို ▁ပြသ သည့် ▁ဝတ်စုံ များကို ▁ဒီဇိုင်နာ ▁မ မီး မီး က ▁ပန်းချီကား
|
| 30 |
+
တစ်ချပ် သဖွယ် ▁ဖန်တီး သူဖြစ်သည်။
|
| 31 |
datasets:
|
| 32 |
- DatarrX/myX-Mega-Corpus
|
| 33 |
---
|
| 34 |
|
| 35 |
+
# 📝 myX-Semantic: A Burmese Sentence Embedding Model
|
| 36 |
+
|
| 37 |
+
## Model Description
|
| 38 |
+
**myX-Semantic** is a sentence-transformer model fine-tuned for the Burmese (Myanmar) language. It maps sentences and paragraphs into a **768-dimensional dense vector space**.
|
| 39 |
+
|
| 40 |
+
This model is built using a **Knowledge Distillation** approach. It utilizes a `paraphrase-multilingual-MiniLM-L12-v2` student architecture, which has been trained to mimic the high-dimensional output of a larger teacher model (`paraphrase-multilingual-mpnet-base-v2`). To ensure compatibility with the teacher's embeddings, a dedicated Dense layer was integrated to project the student's native 384-dimensions into the final 768-dimensional space.
|
| 41 |
+
|
| 42 |
+
### Key Applications
|
| 43 |
+
* **Semantic Textual Similarity (STS):** Measuring how similar two sentences are in meaning.
|
| 44 |
+
* **Semantic Search:** Retrieving relevant documents based on intent rather than keywords.
|
| 45 |
+
* **Text Classification & Clustering:** Grouping similar Burmese texts based on their semantic vectors.
|
| 46 |
+
* **Information Retrieval:** Finding answers or paraphrases in large Burmese datasets.
|
| 47 |
+
|
| 48 |
+
## Development & Distribution
|
| 49 |
+
* **Developed by:** [Khant Sint Heinn (Kalix Louis)](https://huggingface.co/kalixlouiis)
|
| 50 |
+
* **Published by:** [DatarrX (Myanmar Open Source NGO)](https://huggingface.co/DatarrX)
|
| 51 |
+
* **Training Dataset:** [DatarrX/myX-Mega-Corpus](https://huggingface.co/datasets/DatarrX/myX-Mega-Corpus) (1 Million Rows)
|
| 52 |
+
* **Tokenization:** Processed using [DatarrX/myX-Tokenizer](https://huggingface.co/DatarrX/myX-Tokenizer).
|
| 53 |
+
|
| 54 |
+
## Technical Specifications
|
| 55 |
+
- **Base Model:** `sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2`
|
| 56 |
+
- **Max Sequence Length:** 512 tokens
|
| 57 |
+
- **Output Dimension:** 768 dimensions
|
| 58 |
+
- **Similarity Function:** Cosine Similarity
|
| 59 |
+
- **Loss Function:** MSELoss (Mean Squared Error)
|
| 60 |
+
|
| 61 |
+
### Model Architecture
|
| 62 |
+
```text
|
| 63 |
+
SentenceTransformer(
|
| 64 |
+
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False, 'architecture': 'BertModel'})
|
| 65 |
+
(1): Pooling({'word_embedding_dimension': 384, 'pooling_mode_mean_tokens': True})
|
| 66 |
+
(2): Dense({'in_features': 384, 'out_features': 768, 'bias': True, 'activation_function': 'Identity'})
|
| 67 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
```
|
|
|
|
| 69 |
|
| 70 |
+
## Usage
|
| 71 |
|
| 72 |
+
### Installation
|
| 73 |
+
```bash
|
| 74 |
+
pip install -U sentence-transformers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
```
|
|
|
|
|
|
|
| 76 |
|
| 77 |
+
### Direct Usage (Inference)
|
| 78 |
+
```python
|
| 79 |
+
from sentence_transformers import SentenceTransformer, util
|
| 80 |
|
| 81 |
+
# Load the model
|
| 82 |
+
model = SentenceTransformer("DatarrX/myX-Semantic")
|
|
|
|
|
|
|
| 83 |
|
| 84 |
+
# Define sentences
|
| 85 |
+
sentences = [
|
| 86 |
+
"သူနှင့် ကျွန်မ ခဏ ငြိမ်နေလိုက်၏။",
|
| 87 |
+
"ကျွန်တော်တို့ အတူတူ ထိုင်နေကြသည်။",
|
| 88 |
+
"နည်းပညာသည် လူသားတို့အတွက် အရေးကြီးသည်။"
|
| 89 |
+
]
|
| 90 |
|
| 91 |
+
# Compute embeddings
|
| 92 |
+
embeddings = model.encode(sentences)
|
| 93 |
|
| 94 |
+
# Compute similarity scores
|
| 95 |
+
similarities = model.similarity(embeddings, embeddings)
|
| 96 |
+
print(similarities)
|
| 97 |
```
|
| 98 |
|
| 99 |
+
## Implementation Guidelines (Thresholds)
|
| 100 |
+
When using this model for similarity detection or semantic search, the choice of a similarity threshold is crucial for balancing precision and recall. Based on empirical testing:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
+
* **Recommended Threshold:** A Cosine Similarity score of **0.60 or higher** is recommended to determine a strong semantic match.
|
| 103 |
+
* **Comparison:** Compared to lighter models (e.g., 500K-row variants), this 1M-row model exhibits higher confidence in its vector representations. While lower-capacity models might require a threshold around 0.40, **myX-Semantic** is optimized for a more distinctive separation at the 0.60 level.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
+
## Training Details
|
| 106 |
+
* **Samples:** 1,000,000 training pairs.
|
| 107 |
+
* **Batch Size:** 64
|
| 108 |
+
* **Learning Rate:** 3e-5
|
| 109 |
+
* **Optimizer:** AdamW with `round_robin` batch sampling.
|
| 110 |
+
* **Teacher Model:** `paraphrase-multilingual-mpnet-base-v2` (768-dim).
|
| 111 |
|
| 112 |
+
### Training Logs
|
| 113 |
+
| Epoch | Step | Training Loss |
|
| 114 |
+
| :--- | :--- | :--- |
|
| 115 |
+
| 0.06 | 500 | 0.0086 |
|
| 116 |
+
| 0.25 | 2000 | 0.0045 |
|
| 117 |
+
| 0.64 | 5000 | 0.0031 |
|
| 118 |
+
| 0.96 | 7500 | 0.0028 |
|
| 119 |
|
| 120 |
+
## Limitations & Bias
|
| 121 |
+
* **Language:** This model is specifically optimized for Unicode Burmese. It may not perform accurately with Zawgyi-encoded text.
|
| 122 |
+
* **Data Bias:** The model reflects the patterns and biases found in the `myX-Mega-Corpus`. Users should validate results for specific sensitive domains.
|
| 123 |
|
| 124 |
+
## License
|
| 125 |
+
This model is licensed under the **Apache License 2.0**. You are free to use it for research and commercial purposes, provided appropriate credit is given.
|
| 126 |
|
| 127 |
+
## Citation
|
| 128 |
+
If you find this model useful in your project, please cite it:
|
| 129 |
```bibtex
|
| 130 |
@software{khantsintheinn2026myxsemantic,
|
| 131 |
author = {Khant Sint Heinn},
|
| 132 |
+
title = {myX-Semantic: A Burmese Sentence Embedding Model},
|
| 133 |
year = {2026},
|
| 134 |
publisher = {DatarrX},
|
| 135 |
+
url = {https://huggingface.co/DatarrX/myX-Semantic}
|
|
|
|
| 136 |
}
|
| 137 |
```
|
| 138 |
+
## About the Author
|
| 139 |
+
|
| 140 |
+
**Khant Sint Heinn**, working under the name **Kalix Louis**, is a **Machine Learning Engineer focused on Natural Language Processing (NLP), data foundations, and open-source AI development**. His work is centered on improving support for the Burmese (Myanmar) language in modern AI systems by building high-quality datasets, practical tools, and scalable infrastructure for language technology.
|
| 141 |
+
|
| 142 |
+
He is currently the **Lead Developer at DatarrX**, where he develops data pipelines, manages large-scale data collection workflows, and helps create open-source resources for researchers, developers, and organizations. His experience includes data engineering, web scripting, dataset curation, and building systems that support real-world machine learning applications.
|
| 143 |
+
|
| 144 |
+
Khant Sint Heinn is especially interested in advancing low-resource languages and making AI more accessible to underrepresented communities. Through his open-source contributions, he works to strengthen the Burmese (Myanmar) tech ecosystem and provide reliable building blocks for future language models, search systems, and intelligent applications.
|
| 145 |
|
| 146 |
+
His goal is simple: to turn limited language resources into practical opportunities through clean data, useful tools, and community-driven innovation.
|
| 147 |
|
| 148 |
+
**Connect with the Author:**
|
| 149 |
+
[GitHub](https://github.com/kalixlouiis) | [Hugging Face](https://huggingface.co/kalixlouiis) | [Kaggle](https://www.kaggle.com/organizations/kalixlouiis)
|