Commit
·
e0f651c
1
Parent(s):
41c7cee
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,21 +1,25 @@
|
|
| 1 |
---
|
| 2 |
pipeline_tag: sentence-similarity
|
| 3 |
tags:
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
library_name: generic
|
| 9 |
language:
|
| 10 |
-
|
| 11 |
-
- en
|
| 12 |
widget:
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
---
|
| 20 |
|
| 21 |
# bkai-foundation-models/vietnamese-bi-encoder
|
|
@@ -26,7 +30,7 @@ We train the model on a merged training dataset that consists of:
|
|
| 26 |
- Squadv2 (translated in Vietnamese)
|
| 27 |
- 80% of the training set from the Legal Text Retrieval Zalo 2021 challenge
|
| 28 |
|
| 29 |
-
We use phobert-base-v2 as the pre-trained backbone.
|
| 30 |
|
| 31 |
Here are the results on the remaining 20% of the training set from the Legal Text Retrieval Zalo 2021 challenge:
|
| 32 |
|
|
@@ -52,7 +56,9 @@ Then you can use the model like this:
|
|
| 52 |
|
| 53 |
```python
|
| 54 |
from sentence_transformers import SentenceTransformer
|
| 55 |
-
|
|
|
|
|
|
|
| 56 |
|
| 57 |
model = SentenceTransformer('bkai-foundation-models/vietnamese-bi-encoder')
|
| 58 |
embeddings = model.encode(sentences)
|
|
@@ -75,8 +81,8 @@ def mean_pooling(model_output, attention_mask):
|
|
| 75 |
return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)
|
| 76 |
|
| 77 |
|
| 78 |
-
# Sentences we want sentence embeddings
|
| 79 |
-
sentences = ['
|
| 80 |
|
| 81 |
# Load model from HuggingFace Hub
|
| 82 |
tokenizer = AutoTokenizer.from_pretrained('bkai-foundation-models/vietnamese-bi-encoder')
|
|
@@ -96,12 +102,6 @@ print("Sentence embeddings:")
|
|
| 96 |
print(sentence_embeddings)
|
| 97 |
```
|
| 98 |
|
| 99 |
-
## Evaluation Results
|
| 100 |
-
|
| 101 |
-
<!--- Describe how your model was evaluated -->
|
| 102 |
-
|
| 103 |
-
For an automated evaluation of this model, see the _Sentence Embeddings Benchmark_: [https://seb.sbert.net](https://seb.sbert.net?model_name=bkai-foundation-models/vietnamese-bi-encoder)
|
| 104 |
-
|
| 105 |
## Training
|
| 106 |
|
| 107 |
The model was trained with the parameters:
|
|
@@ -148,8 +148,4 @@ SentenceTransformer(
|
|
| 148 |
(0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: RobertaModel
|
| 149 |
(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})
|
| 150 |
)
|
| 151 |
-
```
|
| 152 |
-
|
| 153 |
-
## Citing & Authors
|
| 154 |
-
|
| 155 |
-
<!--- Describe where people can find more information -->
|
|
|
|
| 1 |
---
|
| 2 |
pipeline_tag: sentence-similarity
|
| 3 |
tags:
|
| 4 |
+
- sentence-transformers
|
| 5 |
+
- feature-extraction
|
| 6 |
+
- sentence-similarity
|
| 7 |
+
- transformers
|
| 8 |
library_name: generic
|
| 9 |
language:
|
| 10 |
+
- vi
|
|
|
|
| 11 |
widget:
|
| 12 |
+
- source_sentence: Làm thế nào Đại học Bách khoa Hà Nội thu hút sinh viên quốc tế?
|
| 13 |
+
sentences:
|
| 14 |
+
- >-
|
| 15 |
+
Đại học Bách khoa Hà Nội đã phát triển các chương trình đào tạo bằng tiếng
|
| 16 |
+
Anh để làm cho việc học tại đây dễ dàng hơn cho sinh viên quốc tế.
|
| 17 |
+
- >-
|
| 18 |
+
Môi trường học tập đa dạng và sự hỗ trợ đầy đủ cho sinh viên quốc tế tại Đại
|
| 19 |
+
học Bách khoa Hà Nội giúp họ thích nghi nhanh chóng.
|
| 20 |
+
- Hà Nội có khí hậu mát mẻ vào mùa thu.
|
| 21 |
+
- Các món ăn ở Hà Nội rất ngon và đa dạng.
|
| 22 |
+
license: apache-2.0
|
| 23 |
---
|
| 24 |
|
| 25 |
# bkai-foundation-models/vietnamese-bi-encoder
|
|
|
|
| 30 |
- Squadv2 (translated in Vietnamese)
|
| 31 |
- 80% of the training set from the Legal Text Retrieval Zalo 2021 challenge
|
| 32 |
|
| 33 |
+
We use [phobert-base-v2](https://github.com/VinAIResearch/PhoBERT) as the pre-trained backbone.
|
| 34 |
|
| 35 |
Here are the results on the remaining 20% of the training set from the Legal Text Retrieval Zalo 2021 challenge:
|
| 36 |
|
|
|
|
| 56 |
|
| 57 |
```python
|
| 58 |
from sentence_transformers import SentenceTransformer
|
| 59 |
+
|
| 60 |
+
# INPUT TEXT MUST BE ALREADY WORD-SEGMENTED!
|
| 61 |
+
sentences = ["Cô ấy là một người vui_tính .", "Cô ấy cười nói suốt cả ngày ."]
|
| 62 |
|
| 63 |
model = SentenceTransformer('bkai-foundation-models/vietnamese-bi-encoder')
|
| 64 |
embeddings = model.encode(sentences)
|
|
|
|
| 81 |
return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)
|
| 82 |
|
| 83 |
|
| 84 |
+
# Sentences we want sentence embeddings, we could use pyvi, underthesea, RDRSegment to segment words
|
| 85 |
+
sentences = ['Cô ấy là một người vui_tính .', 'Cô ấy cười nói suốt cả ngày .']
|
| 86 |
|
| 87 |
# Load model from HuggingFace Hub
|
| 88 |
tokenizer = AutoTokenizer.from_pretrained('bkai-foundation-models/vietnamese-bi-encoder')
|
|
|
|
| 102 |
print(sentence_embeddings)
|
| 103 |
```
|
| 104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
## Training
|
| 106 |
|
| 107 |
The model was trained with the parameters:
|
|
|
|
| 148 |
(0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: RobertaModel
|
| 149 |
(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})
|
| 150 |
)
|
| 151 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|