Sentence Similarity
sentence-transformers
Safetensors
Vietnamese
English
xlm-roberta
feature-extraction
Generated from Trainer
loss:MatryoshkaLoss
loss:MultipleNegativesRankingLoss
Eval Results (legacy)
text-embeddings-inference
Instructions to use contextboxai/halong_embedding with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use contextboxai/halong_embedding with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("contextboxai/halong_embedding") sentences = [ "Bóng đá có lợi ích gì cho sức khỏe?", "Bóng đá giúp cải thiện sức khỏe tim mạch và tăng cường sức bền.", "Bóng đá là môn thể thao phổ biến nhất thế giới.", "Bóng đá có thể giúp bạn kết nối với nhiều người hơn." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Inference
- Notebooks
- Google Colab
- Kaggle
Add new SentenceTransformer model.
Browse filesUpdate README.md
update README
update model README
- .gitattributes +1 -0
- 1_Pooling/config.json +10 -0
- README.md +297 -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,297 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: intfloat/multilingual-e5-base
|
| 3 |
+
datasets: []
|
| 4 |
+
language:
|
| 5 |
+
- vi
|
| 6 |
+
- 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 |
+
|
| 148 |
+
# Download from the 🤗 Hub
|
| 149 |
+
model = SentenceTransformer("hiieu/halong_embedding")
|
| 150 |
+
|
| 151 |
+
# Define query and documents
|
| 152 |
+
query = "Bóng đá có lợi ích gì cho sức khỏe?"
|
| 153 |
+
docs = [
|
| 154 |
+
"Bóng đá giúp cải thiện sức khỏe tim mạch và tăng cường sức bền.",
|
| 155 |
+
"Bóng đá là môn thể thao phổ biến nhất thế giới.",
|
| 156 |
+
"Chơi bóng đá giúp giảm căng thẳng và cải thiện tâm lý.",
|
| 157 |
+
"Bóng đá có thể giúp bạn kết nối với nhiều người hơn.",
|
| 158 |
+
"Bóng đá không chỉ là môn thể thao mà còn là cách để giải trí."
|
| 159 |
+
]
|
| 160 |
+
|
| 161 |
+
# Encode query and documents
|
| 162 |
+
query_embedding = model.encode([query])
|
| 163 |
+
doc_embeddings = model.encode(docs)
|
| 164 |
+
similarities = model.similarity(query_embedding, doc_embeddings).flatten()
|
| 165 |
+
|
| 166 |
+
# Sort documents by cosine similarity
|
| 167 |
+
sorted_indices = torch.argsort(similarities, descending=True)
|
| 168 |
+
sorted_docs = [docs[idx] for idx in sorted_indices]
|
| 169 |
+
sorted_scores = [similarities[idx].item() for idx in sorted_indices]
|
| 170 |
+
|
| 171 |
+
# Print sorted documents with their cosine scores
|
| 172 |
+
for doc, score in zip(sorted_docs, sorted_scores):
|
| 173 |
+
print(f"Document: {doc} - Cosine Similarity: {score:.4f}")
|
| 174 |
+
|
| 175 |
+
# 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
|
| 176 |
+
# 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
|
| 177 |
+
# Document: Bóng đá không chỉ là môn thể thao mà còn là cách để giải trí. - Cosine Similarity: 0.6102
|
| 178 |
+
# 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
|
| 179 |
+
# Document: Bóng đá là môn thể thao phổ biến nhất thế giới. - Cosine Similarity: 0.4828
|
| 180 |
+
```
|
| 181 |
+
|
| 182 |
+
<!--
|
| 183 |
+
### Direct Usage (Transformers)
|
| 184 |
+
|
| 185 |
+
<details><summary>Click to see the direct usage in Transformers</summary>
|
| 186 |
+
|
| 187 |
+
</details>
|
| 188 |
+
-->
|
| 189 |
+
|
| 190 |
+
<!--
|
| 191 |
+
### Downstream Usage (Sentence Transformers)
|
| 192 |
+
|
| 193 |
+
You can finetune this model on your own dataset.
|
| 194 |
+
|
| 195 |
+
<details><summary>Click to expand</summary>
|
| 196 |
+
|
| 197 |
+
</details>
|
| 198 |
+
-->
|
| 199 |
+
|
| 200 |
+
<!--
|
| 201 |
+
### Out-of-Scope Use
|
| 202 |
+
|
| 203 |
+
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
| 204 |
+
-->
|
| 205 |
+
|
| 206 |
+
## Evaluation
|
| 207 |
+
|
| 208 |
+
### Metrics
|
| 209 |
+
|
| 210 |
+
#### Information Retrieval
|
| 211 |
+
* Dataset: `updating`
|
| 212 |
+
* note: We sampled 20% of the Zalo Legal train dataset for fast testing; our model did not train on this dataset.
|
| 213 |
+
* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
|
| 214 |
+
|
| 215 |
+
| 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 |
|
| 216 |
+
|----------------------|------------|------------|------------|-------------|-------------|--------------|--------------|---------------|-----------|-----------|-----------|------------|---------|--------|---------|
|
| 217 |
+
|
|
| 218 |
+
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 |
|
| 219 |
+
| 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 |
|
| 220 |
+
| 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 |
|
| 221 |
+
| 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 |
|
| 222 |
+
| 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 |
|
| 223 |
+
| 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 |
|
| 224 |
+
| 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 |
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
<!--
|
| 228 |
+
## Bias, Risks and Limitations
|
| 229 |
+
|
| 230 |
+
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
|
| 231 |
+
-->
|
| 232 |
+
|
| 233 |
+
<!--
|
| 234 |
+
### Recommendations
|
| 235 |
+
|
| 236 |
+
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
|
| 237 |
+
-->
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
## Citation
|
| 241 |
+
|
| 242 |
+
### BibTeX
|
| 243 |
+
|
| 244 |
+
#### Sentence Transformers
|
| 245 |
+
```bibtex
|
| 246 |
+
@inproceedings{reimers-2019-sentence-bert,
|
| 247 |
+
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
|
| 248 |
+
author = "Reimers, Nils and Gurevych, Iryna",
|
| 249 |
+
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
|
| 250 |
+
month = "11",
|
| 251 |
+
year = "2019",
|
| 252 |
+
publisher = "Association for Computational Linguistics",
|
| 253 |
+
url = "https://arxiv.org/abs/1908.10084",
|
| 254 |
+
}
|
| 255 |
+
```
|
| 256 |
+
|
| 257 |
+
#### MatryoshkaLoss
|
| 258 |
+
```bibtex
|
| 259 |
+
@misc{kusupati2024matryoshka,
|
| 260 |
+
title={Matryoshka Representation Learning},
|
| 261 |
+
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},
|
| 262 |
+
year={2024},
|
| 263 |
+
eprint={2205.13147},
|
| 264 |
+
archivePrefix={arXiv},
|
| 265 |
+
primaryClass={cs.LG}
|
| 266 |
+
}
|
| 267 |
+
```
|
| 268 |
+
|
| 269 |
+
#### MultipleNegativesRankingLoss
|
| 270 |
+
```bibtex
|
| 271 |
+
@misc{henderson2017efficient,
|
| 272 |
+
title={Efficient Natural Language Response Suggestion for Smart Reply},
|
| 273 |
+
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},
|
| 274 |
+
year={2017},
|
| 275 |
+
eprint={1705.00652},
|
| 276 |
+
archivePrefix={arXiv},
|
| 277 |
+
primaryClass={cs.CL}
|
| 278 |
+
}
|
| 279 |
+
```
|
| 280 |
+
|
| 281 |
+
<!--
|
| 282 |
+
## Glossary
|
| 283 |
+
|
| 284 |
+
*Clearly define terms in order to be accessible across audiences.*
|
| 285 |
+
-->
|
| 286 |
+
|
| 287 |
+
<!--
|
| 288 |
+
## Model Card Authors
|
| 289 |
+
|
| 290 |
+
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
|
| 291 |
+
-->
|
| 292 |
+
|
| 293 |
+
<!--
|
| 294 |
+
## Model Card Contact
|
| 295 |
+
|
| 296 |
+
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
|
| 297 |
+
-->
|
config.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "/home/hieu/halong_embed/halong_rerank_retrival_3/checkpoint-2000",
|
| 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.41.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.41.2",
|
| 5 |
+
"pytorch": "2.3.1+cu121"
|
| 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 |
+
}
|