Add new SentenceTransformer model.
Browse files- .gitattributes +1 -0
- 1_Pooling/config.json +10 -0
- README.md +352 -0
- config.json +28 -0
- config_sentence_transformers.json +10 -0
- model.safetensors +3 -0
- modules.json +20 -0
- sentence_bert_config.json +4 -0
- special_tokens_map.json +51 -0
- tokenizer.json +3 -0
- tokenizer_config.json +61 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
1_Pooling/config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"word_embedding_dimension": 768,
|
| 3 |
+
"pooling_mode_cls_token": false,
|
| 4 |
+
"pooling_mode_mean_tokens": true,
|
| 5 |
+
"pooling_mode_max_tokens": false,
|
| 6 |
+
"pooling_mode_mean_sqrt_len_tokens": false,
|
| 7 |
+
"pooling_mode_weightedmean_tokens": false,
|
| 8 |
+
"pooling_mode_lasttoken": false,
|
| 9 |
+
"include_prompt": true
|
| 10 |
+
}
|
README.md
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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en
|
| 7 |
+
library_name: sentence-transformers
|
| 8 |
+
license: apache-2.0
|
| 9 |
+
metrics:
|
| 10 |
+
- cosine_accuracy@1
|
| 11 |
+
- cosine_accuracy@3
|
| 12 |
+
- cosine_accuracy@5
|
| 13 |
+
- cosine_accuracy@10
|
| 14 |
+
- cosine_precision@1
|
| 15 |
+
- cosine_precision@3
|
| 16 |
+
- cosine_precision@5
|
| 17 |
+
- cosine_precision@10
|
| 18 |
+
- cosine_recall@1
|
| 19 |
+
- cosine_recall@3
|
| 20 |
+
- cosine_recall@5
|
| 21 |
+
- cosine_recall@10
|
| 22 |
+
- cosine_ndcg@10
|
| 23 |
+
- cosine_mrr@10
|
| 24 |
+
- cosine_map@100
|
| 25 |
+
pipeline_tag: sentence-similarity
|
| 26 |
+
tags:
|
| 27 |
+
- sentence-transformers
|
| 28 |
+
- sentence-similarity
|
| 29 |
+
- feature-extraction
|
| 30 |
+
- generated_from_trainer
|
| 31 |
+
- loss:MatryoshkaLoss
|
| 32 |
+
- loss:MultipleNegativesRankingLoss
|
| 33 |
+
widget:
|
| 34 |
+
- source_sentence: Bóng đá có lợi ích gì cho sức khỏe?
|
| 35 |
+
sentences:
|
| 36 |
+
- Bóng đá giúp cải thiện sức khỏe tim mạch và tăng cường sức bền.
|
| 37 |
+
- Bóng đá là môn thể thao phổ biến nhất thế giới.
|
| 38 |
+
- Bóng đá có thể giúp bạn kết nối với nhiều người hơn.
|
| 39 |
+
|
| 40 |
+
model-index:
|
| 41 |
+
- name: Halong Embedding
|
| 42 |
+
results:
|
| 43 |
+
- task:
|
| 44 |
+
type: information-retrieval
|
| 45 |
+
name: Information Retrieval
|
| 46 |
+
dataset:
|
| 47 |
+
name: dim 768
|
| 48 |
+
type: dim_768
|
| 49 |
+
metrics:
|
| 50 |
+
- type: cosine_accuracy@1
|
| 51 |
+
value: 0.8294209702660407
|
| 52 |
+
name: Cosine Accuracy@1
|
| 53 |
+
- type: cosine_accuracy@3
|
| 54 |
+
value: 0.9233176838810642
|
| 55 |
+
name: Cosine Accuracy@3
|
| 56 |
+
- type: cosine_accuracy@5
|
| 57 |
+
value: 0.9436619718309859
|
| 58 |
+
name: Cosine Accuracy@5
|
| 59 |
+
- type: cosine_accuracy@10
|
| 60 |
+
value: 0.9687010954616588
|
| 61 |
+
name: Cosine Accuracy@10
|
| 62 |
+
- type: cosine_precision@1
|
| 63 |
+
value: 0.8294209702660407
|
| 64 |
+
name: Cosine Precision@1
|
| 65 |
+
- type: cosine_precision@3
|
| 66 |
+
value: 0.3145539906103286
|
| 67 |
+
name: Cosine Precision@3
|
| 68 |
+
- type: cosine_precision@5
|
| 69 |
+
value: 0.1931142410015649
|
| 70 |
+
name: Cosine Precision@5
|
| 71 |
+
- type: cosine_precision@10
|
| 72 |
+
value: 0.09906103286384975
|
| 73 |
+
name: Cosine Precision@10
|
| 74 |
+
- type: cosine_recall@1
|
| 75 |
+
value: 0.8145539906103286
|
| 76 |
+
name: Cosine Recall@1
|
| 77 |
+
- type: cosine_recall@3
|
| 78 |
+
value: 0.9178403755868545
|
| 79 |
+
name: Cosine Recall@3
|
| 80 |
+
- type: cosine_recall@5
|
| 81 |
+
value: 0.9389671361502347
|
| 82 |
+
name: Cosine Recall@5
|
| 83 |
+
- type: cosine_recall@10
|
| 84 |
+
value: 0.9640062597809077
|
| 85 |
+
name: Cosine Recall@10
|
| 86 |
+
- type: cosine_ndcg@10
|
| 87 |
+
value: 0.8976041381292648
|
| 88 |
+
name: Cosine Ndcg@10
|
| 89 |
+
- type: cosine_mrr@10
|
| 90 |
+
value: 0.879893558884169
|
| 91 |
+
name: Cosine Mrr@10
|
| 92 |
+
- type: cosine_map@100
|
| 93 |
+
value: 0.8763179130484675
|
| 94 |
+
name: Cosine Map@100
|
| 95 |
+
|
| 96 |
+
---
|
| 97 |
+
|
| 98 |
+
# Halong Embedding
|
| 99 |
+
|
| 100 |
+
Halong Embedding is a Vietnamese text embedding focused on RAG and production efficiency:
|
| 101 |
+
- 📚 Trained on a in house dataset consist of approximately 100,000 examples of question and related documents
|
| 102 |
+
- 🪆 Trained with a Matryoshka loss, allowing you to truncate embeddings with minimal performance loss: smaller embeddings are faster to compare.
|
| 103 |
+
|
| 104 |
+
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [intfloat/multilingual-e5-base](https://huggingface.co/intfloat/multilingual-e5-base). 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.
|
| 105 |
+
|
| 106 |
+
## Model Details
|
| 107 |
+
|
| 108 |
+
### Model Description
|
| 109 |
+
- **Model Type:** Sentence Transformer
|
| 110 |
+
- **Base model:** [intfloat/multilingual-e5-base](https://huggingface.co/intfloat/multilingual-e5-base) <!-- at revision d13f1b27baf31030b7fd040960d60d909913633f -->
|
| 111 |
+
- **Maximum Sequence Length:** 512 tokens
|
| 112 |
+
- **Output Dimensionality:** 768 tokens
|
| 113 |
+
- **Similarity Function:** Cosine Similarity
|
| 114 |
+
<!-- - **Training Dataset:** Unknown -->
|
| 115 |
+
- **Language:** vi-focused, multilingual
|
| 116 |
+
- **License:** apache-2.0
|
| 117 |
+
|
| 118 |
+
### Model Sources
|
| 119 |
+
|
| 120 |
+
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
|
| 121 |
+
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
|
| 122 |
+
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
|
| 123 |
+
|
| 124 |
+
### Full Model Architecture
|
| 125 |
+
|
| 126 |
+
```
|
| 127 |
+
SentenceTransformer(
|
| 128 |
+
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: XLMRobertaModel
|
| 129 |
+
(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})
|
| 130 |
+
(2): Normalize()
|
| 131 |
+
)
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
## Usage
|
| 135 |
+
|
| 136 |
+
### Direct Usage (Sentence Transformers)
|
| 137 |
+
|
| 138 |
+
First install the Sentence Transformers library:
|
| 139 |
+
|
| 140 |
+
```bash
|
| 141 |
+
pip install -U sentence-transformers
|
| 142 |
+
```
|
| 143 |
+
|
| 144 |
+
Then you can load this model and run inference.
|
| 145 |
+
```python
|
| 146 |
+
from sentence_transformers import SentenceTransformer
|
| 147 |
+
import torch
|
| 148 |
+
|
| 149 |
+
# Download from the 🤗 Hub
|
| 150 |
+
model = SentenceTransformer("hiieu/halong_embedding")
|
| 151 |
+
|
| 152 |
+
# Define query and documents
|
| 153 |
+
query = "Bóng đá có lợi ích gì cho sức khỏe?"
|
| 154 |
+
docs = [
|
| 155 |
+
"Bóng đá giúp cải thiện sức khỏe tim mạch và tăng cường sức bền.",
|
| 156 |
+
"Bóng đá là môn thể thao phổ biến nhất thế giới.",
|
| 157 |
+
"Chơi bóng đá giúp giảm căng thẳng và cải thiện tâm lý.",
|
| 158 |
+
"Bóng đá có thể giúp bạn kết nối với nhiều người hơn.",
|
| 159 |
+
"Bóng đá không chỉ là môn thể thao mà còn là cách để giải trí."
|
| 160 |
+
]
|
| 161 |
+
|
| 162 |
+
# Encode query and documents
|
| 163 |
+
query_embedding = model.encode([query])
|
| 164 |
+
doc_embeddings = model.encode(docs)
|
| 165 |
+
similarities = model.similarity(query_embedding, doc_embeddings).flatten()
|
| 166 |
+
|
| 167 |
+
# Sort documents by cosine similarity
|
| 168 |
+
sorted_indices = torch.argsort(similarities, descending=True)
|
| 169 |
+
sorted_docs = [docs[idx] for idx in sorted_indices]
|
| 170 |
+
sorted_scores = [similarities[idx].item() for idx in sorted_indices]
|
| 171 |
+
|
| 172 |
+
# Print sorted documents with their cosine scores
|
| 173 |
+
for doc, score in zip(sorted_docs, sorted_scores):
|
| 174 |
+
print(f"Document: {doc} - Cosine Similarity: {score:.4f}")
|
| 175 |
+
|
| 176 |
+
# Document: Bóng đá giúp cải thiện sức khỏe tim mạch và tăng cường sức bền. - Cosine Similarity: 0.7318
|
| 177 |
+
# Document: Chơi bóng đá giúp giảm căng thẳng và cải thiện tâm lý. - Cosine Similarity: 0.6623
|
| 178 |
+
# Document: Bóng đá không chỉ là môn thể thao mà còn là cách để giải trí. - Cosine Similarity: 0.6102
|
| 179 |
+
# Document: Bóng đá có thể giúp bạn kết nối với nhiều người hơn. - Cosine Similarity: 0.4988
|
| 180 |
+
# Document: Bóng đá là môn thể thao phổ biến nhất thế giới. - Cosine Similarity: 0.4828
|
| 181 |
+
```
|
| 182 |
+
|
| 183 |
+
### Matryoshka Embeddings Inference
|
| 184 |
+
```python
|
| 185 |
+
from sentence_transformers import SentenceTransformer
|
| 186 |
+
import torch.nn.functional as F
|
| 187 |
+
import torch
|
| 188 |
+
|
| 189 |
+
matryoshka_dim = 64
|
| 190 |
+
model = SentenceTransformer(
|
| 191 |
+
"hiieu/halong_embedding",
|
| 192 |
+
truncate_dim=matryoshka_dim,
|
| 193 |
+
)
|
| 194 |
+
|
| 195 |
+
# Define query and documents
|
| 196 |
+
query = "Bóng đá có lợi ích gì cho sức khỏe?"
|
| 197 |
+
docs = [
|
| 198 |
+
"Bóng đá giúp cải thiện sức khỏe tim mạch và tăng cường sức bền.",
|
| 199 |
+
"Bóng đá là môn thể thao phổ biến nhất thế giới.",
|
| 200 |
+
"Chơi bóng đá giúp giảm căng thẳng và cải thiện tâm lý.",
|
| 201 |
+
"Bóng đá có thể giúp bạn kết nối với nhiều người hơn.",
|
| 202 |
+
"Bóng đá không chỉ là môn thể thao mà còn là cách để giải trí."
|
| 203 |
+
]
|
| 204 |
+
|
| 205 |
+
# Encode query and documents
|
| 206 |
+
query_embedding = model.encode([query])
|
| 207 |
+
doc_embeddings = model.encode(docs)
|
| 208 |
+
similarities = model.similarity(query_embedding, doc_embeddings).flatten()
|
| 209 |
+
|
| 210 |
+
# Sort documents by cosine similarity
|
| 211 |
+
sorted_indices = torch.argsort(similarities, descending=True)
|
| 212 |
+
sorted_docs = [docs[idx] for idx in sorted_indices]
|
| 213 |
+
sorted_scores = [similarities[idx].item() for idx in sorted_indices]
|
| 214 |
+
|
| 215 |
+
# Print sorted documents with their cosine scores
|
| 216 |
+
for doc, score in zip(sorted_docs, sorted_scores):
|
| 217 |
+
print(f"Document: {doc} - Cosine Similarity: {score:.4f}")
|
| 218 |
+
|
| 219 |
+
# Document: Bóng đá giúp cải thiện sức khỏe tim mạch và tăng cường sức bền. - Cosine Similarity: 0.8045
|
| 220 |
+
# Document: Chơi bóng đá giúp giảm căng thẳng và cải thiện tâm lý. - Cosine Similarity: 0.7676
|
| 221 |
+
# Document: Bóng đá không chỉ là môn thể thao mà còn là cách để giải trí. - Cosine Similarity: 0.6758
|
| 222 |
+
# Document: Bóng đá có thể giúp bạn kết nối với nhiều người hơn. - Cosine Similarity: 0.5931
|
| 223 |
+
# Document: Bóng đá là môn thể thao phổ biến nhất thế giới. - Cosine Similarity: 0.5105
|
| 224 |
+
```
|
| 225 |
+
<!--
|
| 226 |
+
### Direct Usage (Transformers)
|
| 227 |
+
|
| 228 |
+
<details><summary>Click to see the direct usage in Transformers</summary>
|
| 229 |
+
|
| 230 |
+
</details>
|
| 231 |
+
-->
|
| 232 |
+
|
| 233 |
+
<!--
|
| 234 |
+
### Downstream Usage (Sentence Transformers)
|
| 235 |
+
|
| 236 |
+
You can finetune this model on your own dataset.
|
| 237 |
+
|
| 238 |
+
<details><summary>Click to expand</summary>
|
| 239 |
+
|
| 240 |
+
</details>
|
| 241 |
+
-->
|
| 242 |
+
|
| 243 |
+
<!--
|
| 244 |
+
### Out-of-Scope Use
|
| 245 |
+
|
| 246 |
+
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
| 247 |
+
-->
|
| 248 |
+
|
| 249 |
+
## Evaluation
|
| 250 |
+
|
| 251 |
+
### Metrics
|
| 252 |
+
|
| 253 |
+
#### Information Retrieval
|
| 254 |
+
* Dataset: [Zalo legal retrieval dataet](https://huggingface.co/datasets/hiieu/legal_eval_label)
|
| 255 |
+
* *note*: We sampled 20% of the Zalo Legal train dataset for fast testing; our model did not train on this dataset.
|
| 256 |
+
* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
|
| 257 |
+
|
| 258 |
+
| Model | Accuracy@1 | Accuracy@3 | Accuracy@5 | Accuracy@10 | Precision@1 | Precision@3 | Precision@5 | Precision@10 | Recall@1 | Recall@3 | Recall@5 | Recall@10 | NDCG@10 | MRR@10 | MAP@100 |
|
| 259 |
+
|----------------------|------------|------------|------------|-------------|-------------|--------------|--------------|---------------|-----------|-----------|-----------|------------|---------|--------|---------|
|
| 260 |
+
|
|
| 261 |
+
vietnamese-bi-encoder | 0.8169 | 0.9108 | 0.9437 | 0.9640 | 0.8169 | 0.3099 | 0.1931 | 0.0987 | 0.8020 | 0.9045 | 0.9390 | 0.9601 | 0.8882 | 0.8685 | 0.8652 |
|
| 262 |
+
| sup-SimCSE-VietNamese-phobert-base | 0.5540 | 0.7308 | 0.7981 | 0.8748 | 0.5540 | 0.2473 | 0.1621 | 0.0892 | 0.5446 | 0.7246 | 0.7903 | 0.8693 | 0.7068 | 0.6587 | 0.6592 |
|
| 263 |
+
| halong_embedding (768) | 0.8294 | 0.9233 | 0.9437 | 0.9687 | 0.8294 | 0.3146 | 0.1931 | 0.0991 | 0.8146 | 0.9178 | 0.9390 | 0.9640 | 0.8976 | 0.8799 | 0.8763 |
|
| 264 |
+
| halong_embedding (512) | 0.8138 | 0.9233 | 0.9390 | 0.9703 | 0.8138 | 0.3146 | 0.1922 | 0.0992 | 0.7989 | 0.9178 | 0.9343 | 0.9656 | 0.8917 | 0.8715 | 0.8678 |
|
| 265 |
+
| halong_embedding (256) | 0.7934 | 0.8967 | 0.9280 | 0.9593 | 0.7934 | 0.3062 | 0.1900 | 0.0981 | 0.7786 | 0.8920 | 0.9233 | 0.9546 | 0.8743 | 0.8520 | 0.8489 |
|
| 266 |
+
| halong_embedding (128) | 0.7840 | 0.8951 | 0.9264 | 0.9515 | 0.7840 | 0.3046 | 0.1894 | 0.0975 | 0.7707 | 0.8889 | 0.9210 | 0.9476 | 0.8669 | 0.8439 | 0.8412 |
|
| 267 |
+
| halong_embedding (64) | 0.6980 | 0.8435 | 0.8920 | 0.9358 | 0.6980 | 0.2864 | 0.1815 | 0.0958 | 0.6854 | 0.8365 | 0.8842 | 0.9311 | 0.8145 | 0.7805 | 0.7775 |
|
| 268 |
+
|
| 269 |
+
|
| 270 |
+
<!--
|
| 271 |
+
## Bias, Risks and Limitations
|
| 272 |
+
|
| 273 |
+
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
|
| 274 |
+
-->
|
| 275 |
+
|
| 276 |
+
<!--
|
| 277 |
+
### Recommendations
|
| 278 |
+
|
| 279 |
+
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
|
| 280 |
+
-->
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
## Citation
|
| 284 |
+
|
| 285 |
+
You can cite our work as below:
|
| 286 |
+
|
| 287 |
+
```Plaintext
|
| 288 |
+
@misc{HalongEmbedding,
|
| 289 |
+
title={HalongEmbedding: A Vietnamese Text Embedding},
|
| 290 |
+
author={Ngo Hieu},
|
| 291 |
+
year={2024},
|
| 292 |
+
publisher={Huggingface},
|
| 293 |
+
}
|
| 294 |
+
```
|
| 295 |
+
|
| 296 |
+
|
| 297 |
+
### BibTeX
|
| 298 |
+
|
| 299 |
+
#### Sentence Transformers
|
| 300 |
+
```bibtex
|
| 301 |
+
@inproceedings{reimers-2019-sentence-bert,
|
| 302 |
+
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
|
| 303 |
+
author = "Reimers, Nils and Gurevych, Iryna",
|
| 304 |
+
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
|
| 305 |
+
month = "11",
|
| 306 |
+
year = "2019",
|
| 307 |
+
publisher = "Association for Computational Linguistics",
|
| 308 |
+
url = "https://arxiv.org/abs/1908.10084",
|
| 309 |
+
}
|
| 310 |
+
```
|
| 311 |
+
|
| 312 |
+
#### MatryoshkaLoss
|
| 313 |
+
```bibtex
|
| 314 |
+
@misc{kusupati2024matryoshka,
|
| 315 |
+
title={Matryoshka Representation Learning},
|
| 316 |
+
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},
|
| 317 |
+
year={2024},
|
| 318 |
+
eprint={2205.13147},
|
| 319 |
+
archivePrefix={arXiv},
|
| 320 |
+
primaryClass={cs.LG}
|
| 321 |
+
}
|
| 322 |
+
```
|
| 323 |
+
|
| 324 |
+
#### MultipleNegativesRankingLoss
|
| 325 |
+
```bibtex
|
| 326 |
+
@misc{henderson2017efficient,
|
| 327 |
+
title={Efficient Natural Language Response Suggestion for Smart Reply},
|
| 328 |
+
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},
|
| 329 |
+
year={2017},
|
| 330 |
+
eprint={1705.00652},
|
| 331 |
+
archivePrefix={arXiv},
|
| 332 |
+
primaryClass={cs.CL}
|
| 333 |
+
}
|
| 334 |
+
```
|
| 335 |
+
|
| 336 |
+
<!--
|
| 337 |
+
## Glossary
|
| 338 |
+
|
| 339 |
+
*Clearly define terms in order to be accessible across audiences.*
|
| 340 |
+
-->
|
| 341 |
+
|
| 342 |
+
<!--
|
| 343 |
+
## Model Card Authors
|
| 344 |
+
|
| 345 |
+
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
|
| 346 |
+
-->
|
| 347 |
+
|
| 348 |
+
<!--
|
| 349 |
+
## Model Card Contact
|
| 350 |
+
|
| 351 |
+
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
|
| 352 |
+
-->
|
config.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "hiieu/halong_embedding",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"XLMRobertaModel"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"classifier_dropout": null,
|
| 9 |
+
"eos_token_id": 2,
|
| 10 |
+
"hidden_act": "gelu",
|
| 11 |
+
"hidden_dropout_prob": 0.1,
|
| 12 |
+
"hidden_size": 768,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 3072,
|
| 15 |
+
"layer_norm_eps": 1e-05,
|
| 16 |
+
"max_position_embeddings": 514,
|
| 17 |
+
"model_type": "xlm-roberta",
|
| 18 |
+
"num_attention_heads": 12,
|
| 19 |
+
"num_hidden_layers": 12,
|
| 20 |
+
"output_past": true,
|
| 21 |
+
"pad_token_id": 1,
|
| 22 |
+
"position_embedding_type": "absolute",
|
| 23 |
+
"torch_dtype": "float32",
|
| 24 |
+
"transformers_version": "4.45.2",
|
| 25 |
+
"type_vocab_size": 1,
|
| 26 |
+
"use_cache": true,
|
| 27 |
+
"vocab_size": 250002
|
| 28 |
+
}
|
config_sentence_transformers.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"__version__": {
|
| 3 |
+
"sentence_transformers": "3.0.1",
|
| 4 |
+
"transformers": "4.45.2",
|
| 5 |
+
"pytorch": "2.3.1+cpu"
|
| 6 |
+
},
|
| 7 |
+
"prompts": {},
|
| 8 |
+
"default_prompt_name": null,
|
| 9 |
+
"similarity_fn_name": null
|
| 10 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2fd083778d8b1f54d7ad106d1e279b5e0f6f2f9f71ae095cf91107b6e54131ab
|
| 3 |
+
size 1112197096
|
modules.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"idx": 0,
|
| 4 |
+
"name": "0",
|
| 5 |
+
"path": "",
|
| 6 |
+
"type": "sentence_transformers.models.Transformer"
|
| 7 |
+
},
|
| 8 |
+
{
|
| 9 |
+
"idx": 1,
|
| 10 |
+
"name": "1",
|
| 11 |
+
"path": "1_Pooling",
|
| 12 |
+
"type": "sentence_transformers.models.Pooling"
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"idx": 2,
|
| 16 |
+
"name": "2",
|
| 17 |
+
"path": "2_Normalize",
|
| 18 |
+
"type": "sentence_transformers.models.Normalize"
|
| 19 |
+
}
|
| 20 |
+
]
|
sentence_bert_config.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"max_seq_length": 512,
|
| 3 |
+
"do_lower_case": false
|
| 4 |
+
}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"cls_token": {
|
| 10 |
+
"content": "<s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"eos_token": {
|
| 17 |
+
"content": "</s>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"mask_token": {
|
| 24 |
+
"content": "<mask>",
|
| 25 |
+
"lstrip": true,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
},
|
| 30 |
+
"pad_token": {
|
| 31 |
+
"content": "<pad>",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": false,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false
|
| 36 |
+
},
|
| 37 |
+
"sep_token": {
|
| 38 |
+
"content": "</s>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false
|
| 43 |
+
},
|
| 44 |
+
"unk_token": {
|
| 45 |
+
"content": "<unk>",
|
| 46 |
+
"lstrip": false,
|
| 47 |
+
"normalized": false,
|
| 48 |
+
"rstrip": false,
|
| 49 |
+
"single_word": false
|
| 50 |
+
}
|
| 51 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:883b037111086fd4dfebbbc9b7cee11e1517b5e0c0514879478661440f137085
|
| 3 |
+
size 17082987
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"0": {
|
| 4 |
+
"content": "<s>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"1": {
|
| 12 |
+
"content": "<pad>",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
},
|
| 19 |
+
"2": {
|
| 20 |
+
"content": "</s>",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"special": true
|
| 26 |
+
},
|
| 27 |
+
"3": {
|
| 28 |
+
"content": "<unk>",
|
| 29 |
+
"lstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"single_word": false,
|
| 33 |
+
"special": true
|
| 34 |
+
},
|
| 35 |
+
"250001": {
|
| 36 |
+
"content": "<mask>",
|
| 37 |
+
"lstrip": true,
|
| 38 |
+
"normalized": false,
|
| 39 |
+
"rstrip": false,
|
| 40 |
+
"single_word": false,
|
| 41 |
+
"special": true
|
| 42 |
+
}
|
| 43 |
+
},
|
| 44 |
+
"bos_token": "<s>",
|
| 45 |
+
"clean_up_tokenization_spaces": true,
|
| 46 |
+
"cls_token": "<s>",
|
| 47 |
+
"eos_token": "</s>",
|
| 48 |
+
"mask_token": "<mask>",
|
| 49 |
+
"max_length": 512,
|
| 50 |
+
"model_max_length": 512,
|
| 51 |
+
"pad_to_multiple_of": null,
|
| 52 |
+
"pad_token": "<pad>",
|
| 53 |
+
"pad_token_type_id": 0,
|
| 54 |
+
"padding_side": "right",
|
| 55 |
+
"sep_token": "</s>",
|
| 56 |
+
"stride": 0,
|
| 57 |
+
"tokenizer_class": "XLMRobertaTokenizer",
|
| 58 |
+
"truncation_side": "right",
|
| 59 |
+
"truncation_strategy": "longest_first",
|
| 60 |
+
"unk_token": "<unk>"
|
| 61 |
+
}
|