bkai-foundation-models_vietnamese-bi-encoder
bkai-foundation-models · View on Hugging Face ↗
Model card
The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.
pipeline_tag: sentence-similarity tags:
- sentence-transformers
- feature-extraction
- sentence-similarity
- transformers library_name: generic language:
- vi widget:
- 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ế?
sentences:
Đạ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 Anh để làm cho việc học tại đây dễ dàng hơn cho sinh viên quốc tế.
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 học Bách khoa Hà Nội giúp họ thích nghi nhanh chóng.
- Hà Nội có khí hậu mát mẻ vào mùa thu.
- Các món ăn ở Hà Nội rất ngon và đa dạng. license: apache-2.0
bkai-foundation-models/vietnamese-bi-encoder
This is a sentence-transformers model: It maps sentences & paragraphs to a 768 dimensional dense vector space and can be used for tasks like clustering or semantic search.
We train the model on a merged training dataset that consists of:
- MS Macro (translated into Vietnamese)
- SQuAD v2 (translated into Vietnamese)
- 80% of the training set from the Legal Text Retrieval Zalo 2021 challenge
We use phobert-base-v2 as the pre-trained backbone.
Here are the results on the remaining 20% of the training set from the Legal Text Retrieval Zalo 2021 challenge:
| Pretrained Model | Training Datasets | Acc@1 | Acc@10 | Acc@100 | Pre@10 | MRR@10 |
|---|---|---|---|---|---|---|
| Vietnamese-SBERT | - | 32.34 | 52.97 | 89.84 | 7.05 | 45.30 |
| PhoBERT-base-v2 | MSMACRO | 47.81 | 77.19 | 92.34 | 7.72 | 58.37 |
| PhoBERT-base-v2 | MSMACRO + SQuADv2.0 + 80% Zalo | 73.28 | 93.59 | 98.85 | 9.36 | 80.73 |
Usage (Sentence-Transformers)
Using this model becomes easy when you have sentence-transformers installed:
pip install -U sentence-transformers
Then you can use the model like this:
from sentence_transformers import SentenceTransformer
# INPUT TEXT MUST BE ALREADY WORD-SEGMENTED!
sentences = ["Cô ấy là một người vui_tính .", "Cô ấy cười nói suốt cả ngày ."]
model = SentenceTransformer('bkai-foundation-models/vietnamese-bi-encoder')
embeddings = model.encode(sentences)
print(embeddings)
Usage (Widget HuggingFace)
The widget use custom pipeline on top of the default pipeline by adding additional word segmenter before PhobertTokenizer. So you do not need to segment words before using the API:
An example could be seen in Hosted inference API.
Usage (HuggingFace Transformers)
Without sentence-transformers, you can use the model like this: First, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings.
from transformers import AutoTokenizer, AutoModel
import torch
#Mean Pooling - Take attention mask into account for correct averaging
def mean_pooling(model_output, attention_mask):
token_embeddings = model_output[0] #First element of model_output contains all token embeddings
input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)
# Sentences we want sentence embeddings, we could use pyvi, underthesea, RDRSegment to segment words
sentences = ['Cô ấy là một người vui_tính .', 'Cô ấy cười nói suốt cả ngày .']
# Load model from HuggingFace Hub
tokenizer = AutoTokenizer.from_pretrained('bkai-foundation-models/vietnamese-bi-encoder')
model = AutoModel.from_pretrained('bkai-foundation-models/vietnamese-bi-encoder')
# Tokenize sentences
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
# Compute token embeddings
with torch.no_grad():
model_output = model(**encoded_input)
# Perform pooling. In this case, mean pooling.
sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask'])
print("Sentence embeddings:")
print(sentence_embeddings)
Training
The model was trained with the parameters:
DataLoader:
torch.utils.data.dataloader.DataLoader of length 17584 with parameters:
{'batch_size': 32, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
Loss:
sentence_transformers.losses.MultipleNegativesRankingLoss.MultipleNegativesRankingLoss with parameters:
{'scale': 20.0, 'similarity_fct': 'cos_sim'}
Parameters of the fit()-Method:
{
"epochs": 15,
"evaluation_steps": 0,
"evaluator": "NoneType",
"max_grad_norm": 1,
"optimizer_class": "<class 'torch.optim.adamw.AdamW'>",
"optimizer_params": {
"lr": 2e-05
},
"scheduler": "WarmupLinear",
"steps_per_epoch": null,
"warmup_steps": 1000,
"weight_decay": 0.01
}
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: RobertaModel
(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})
)
Please cite our manuscript if this dataset is used for your work
@article{duc2024towards,
title={Towards Comprehensive Vietnamese Retrieval-Augmented Generation and Large Language Models},
author={Nguyen Quang Duc, Le Hai Son, Nguyen Duc Nhan, Nguyen Dich Nhat Minh, Le Thanh Huong, Dinh Viet Sang},
journal={arXiv preprint arXiv:2403.01616},
year={2024}
}
Magnet link
Opens the swarm directly in your torrent client — no file download needed. Copy-paste works too:
magnet:?xt=urn:btih:edda10f222fb7d36a57655fd5edbd2ffb9c02fe8&dn=bkai-foundation-models_vietnamese-bi-encoderOpen magnet in torrent client · infohash edda10f222fb7d36a57655fd5edbd2ffb9c02fe8
Files & hashes
| Path | Size | sha1 | sha256 |
|---|---|---|---|
| 1_Pooling/config.json | 270 B (270 B) | 0ad909d08489a976a0c81e64c7c2134b44296392 | f2fa6333d3899e2f9368e2e2741ece8e74160337b3698f475f6e0f7f28e396fe |
| README.md | 6.3 KB (6,465 B) | db42e00c42665df228ee12991c73d9d3fd0cda08 | 1433a6a36fb9b991999ce5eab31de89f6ebf31ef3c3a0c30c7b61685fa2ed878 |
| added_tokens.json | 22 B (22 B) | 1f6ddcea4cb4f94f751b1315127d0d24ac2a17c8 | 956163bbe8b0625fcc779207447308285eab218ffe0551d3e0deeae5538da326 |
| bpe.codes | 1.1 MB (1,135,173 B) | b9a70c1a314ef0c6d97dffd98b34a1c60b988a6e | 9dfe53fb8abbddd3387da99641c36e00bee757a3679aad9cf0a7cdc4b30f6ef8 |
| config.json | 777 B (777 B) | 2b7e2f4a993e27e12b496c95be1a1e7de68b6b28 | 5f28d12a2d641db00b6dfaff47517b9cf6175437ceb0e18ec0763938ab4b086f |
| config_sentence_transformers.json | 123 B (123 B) | 8ae70e468be5c5c0317b8418db9473dd659631da | 5a6d09833ba6faaf8b7e35d805fc6ecc42577b78173a76b6a97ea00e25a2bbb2 |
| custom_tokenizer.py | 325 B (325 B) | 534792704e214a8d0f7675a37e9556f20b93135a | 0f64adb63bec5dc4bb95a74795d30b3ee1645f9026ce4df3534fd08797a3a8d8 |
| model.safetensors | 515.0 MB (540,015,464 B) | bc543d0705b8b072f43c91d6624a341188bf4d11 | e681accadaec87e79901db0c3f68e33d996cba334633b6dd0b2483dba4f398e0 |
| modules.json | 229 B (229 B) | f7640f94e81bb7f4f04daf1668850b38763a13d9 | 8f4b264b80206c830bebbdcae377e137925650a433b689343a63bdc9b3145460 |
| pipeline.py | 2.6 KB (2,705 B) | 3bfb6b13d5833454b0f254760f03fdd75aad68f2 | 99ace46d4ff756f682f484e3a1072be21f89a146231254c9cf290ec5efe54c36 |
| pytorch_model.bin | 515.0 MB (540,057,065 B) | 6abd71c743626e7b52a5c7c1d0d047e1f82e6e21 | 2d8135cb6ff79bf4303fb0afd11808791c9123ae8ee753fccd480207e347963e |
| requirements.txt | 11 B (11 B) | 7f17e38b881bb1d79ff96462a9b04c7d92f3e85a | 2153a0422bddac72fdb08f059050b4609187e1ec10c9ac79531e3352f2def5f9 |
| sentence_bert_config.json | 53 B (53 B) | 59d594003bf59880a884c574bf88ef7555bb0202 | fc1993fde0a95c24ec6c022539d41cf6e2f7c9721e5415d6fb6897472a9cd4b7 |
| special_tokens_map.json | 167 B (167 B) | e0b1d18ecd0ae4ff1d47bd297d910c0cf83e504b | d05497f1da52c5e09554c0cd874037a083e1dc1b9cfd48034d1c717f1afc07a7 |
| tokenizer_config.json | 1.1 KB (1,172 B) | d88ee214e08508f414953a23aada93228591df76 | 9410af29b3eebbe69a1a0d8f3e1104e131409223cffcec9cf6ee46afd5892b88 |
| vocab.txt | 874.3 KB (895,321 B) | 0dbdec11459dd9d1f6e985bf6c58dbcf6adaeabd | dffd7543c401fb6567253ae7c3313004532c33d062525250049c616544bad777 |
Cite this release
- Canonical URL
- https://aiseedbank.org/models/bkai-foundation-models_vietnamese-bi-encoder/
- Slug
- bkai-foundation-models_vietnamese-bi-encoder
- Infohash
- edda10f222fb7d36a57655fd5edbd2ffb9c02fe8
- License
- apache-2.0
- Signing key fingerprint
- 85a3b32c3712427b
Every file carries a locally computed sha256 — verify a download against the signed sums: bkai-foundation-models_vietnamese-bi-encoder.SHA256SUMS (+ minisign signature).
Provenance
| Upstream repository | bkai-foundation-models/vietnamese-bi-encoder |
|---|---|
| Revision (pinned) | 84f9d9ada0d1a3c37557398b9ae9fcedcdf40be0 |
| Fetched at | 2026-09-03T21:05:12Z |
| License at fetch | apache-2.0 |
| Snapshot tool | huggingface · seedbank 0.1.0 |
Trackers
- udp://announce.aitorrent.org:6969/announce
- http://announce.aitorrent.org:7070/announce
- udp://announce2.aitorrent.org:6970/announce
- http://announce2.aitorrent.org:7071/announce
- udp://tracker.opentrackr.org:1337/announce
- udp://open.demonii.com:1337/announce
- udp://open.stealth.si:80/announce
- udp://exodus.desync.com:6969/announce
- udp://tracker.torrent.eu.org:451/announce
✓ verified · rehash-vs-hf-metadata at 2026-09-03T21:05:25Z
apache-2.01.01 GB (1,082,115,342 bytes)genericpytorchsafetensorsrobertafeature-extractionsentence-transformerssentence-similaritytransformers1 language (vi)paper: 2403.01616