Downloads · 30 days
97
25% of all-time downloads
namnguyenba2003/Vietnamese_Law_Embedding_finetuned
Vietnamese_Law_Embedding_finetuned is a sentence similarity model from namnguyenba2003. Use it when you need a score for how close two texts are. It is set up for sentence-transformers. The card lists the license as apache-2.0.
This is a sentence-transformers model finetuned from AITeamVN/VietnameseEmbedding on the json dataset. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for semantic textual simil…
Downloads · 30 days
97
25% of all-time downloads
All-time downloads
382
Public
Parameters
568M
2.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.3 GB · 99%
From the Hugging Face model README
This is a sentence-transformers model finetuned from AITeamVN/Vietnamese_Embedding on the json dataset. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
SentenceTransformer(
(0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: XLMRobertaModel
(1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
(2): Normalize()
)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("namnguyenba2003/Vietnamese_Law_Embedding_finetuned")
# Run inference
sentences = [
'Điều 9. Hồ sơ làm căn cứ để đánh giá đáp ứng GACP\n1. Đơn đề nghị đánh giá theo Mẫu số 1A Phụ lục I Thông tư này.\n2. Bản sao có xác nhận của đơn vị đối với Quyết định thành lập hoặc Giấy chứng nhận đăng ký kinh doanh hoặc Giấy phép đầu tư (đối với trường hợp quy định tại Điểm a Khoản 1 Điều 8 Thông tư này).\n3. Sơ đồ tổ chức và nhân sự của cơ sở (nêu rõ các bộ phận chủ chốt của cơ sở: họ tên, chức danh, trình độ chuyên môn và kinh nghiệm công tác của các trưởng bộ phận). Trường hợp cơ sở gồm nhiều hộ gia đình thì phải gửi kèm danh sách họ tên, địa chỉ, địa điểm, diện tích nuôi trồng, khai thác và hợp đồng thu mua giữa cơ sở với các hộ gia đình/đại diện các hộ gia đình.\n4. Sơ đồ phân lô khu vực nuôi trồng, khai thác và bản thuyết minh các khu vực nuôi trồng, khai thác, sơ chế, chế biến và bảo quản.\n5. Kế hoạch, nội dung và kết quả đào tạo về GACP cho nhân viên của cơ sở trong năm nộp hồ sơ.',
'Theo quy định, cơ sở nuôi trồng, khai thác dược liệu phải cung cấp những thông tin gì về tổ chức và nhân sự của cơ sở để được đánh giá đáp ứng GACP?',
'Nếu một đơn vị đã đưa tài sản cố định vào sử dụng nhưng chưa có quyết toán được phê duyệt, họ sẽ xác định nguyên giá tài sản như thế nào?',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
<!--
### Direct Usage (Transformers)
<details><summary>Click to see the direct usage in Transformers</summary>
</details>
-->
<!--
### Downstream Usage (Sentence Transformers)
You can finetune this model on your own dataset.
<details><summary>Click to expand</summary>
</details>
-->
<!--
### Out-of-Scope Use
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->
dim_1024{
"truncate_dim": 1024
}
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.7351 |
| cosine_accuracy@3 | 0.7786 |
| cosine_accuracy@5 | 0.8664 |
| cosine_accuracy@10 | 0.9293 |
| cosine_precision@1 | 0.7351 |
| cosine_precision@3 | 0.6866 |
| cosine_precision@5 | 0.484 |
| cosine_precision@10 | 0.2677 |
| cosine_recall@1 | 0.2735 |
| cosine_recall@3 | 0.7252 |
| cosine_recall@5 | 0.8354 |
| cosine_recall@10 | 0.9222 |
| cosine_ndcg@10 | 0.8336 |
| cosine_mrr@10 | 0.781 |
| cosine_map@100 | 0.8092 |
dim_768{
"truncate_dim": 768
}
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.7348 |
| cosine_accuracy@3 | 0.7755 |
| cosine_accuracy@5 | 0.866 |
| cosine_accuracy@10 | 0.9278 |
| cosine_precision@1 | 0.7348 |
| cosine_precision@3 | 0.6841 |
| cosine_precision@5 | 0.4834 |
| cosine_precision@10 | 0.2673 |
| cosine_recall@1 | 0.2739 |
| cosine_recall@3 | 0.723 |
| cosine_recall@5 | 0.8348 |
| cosine_recall@10 | 0.9212 |
| cosine_ndcg@10 | 0.8328 |
| cosine_mrr@10 | 0.7801 |
| cosine_map@100 | 0.8087 |
dim_512{
"truncate_dim": 512
}
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.725 |
| cosine_accuracy@3 | 0.7701 |
| cosine_accuracy@5 | 0.8598 |
| cosine_accuracy@10 | 0.927 |
| cosine_precision@1 | 0.725 |
| cosine_precision@3 | 0.6782 |
| cosine_precision@5 | 0.4795 |
| cosine_precision@10 | 0.2668 |
| cosine_recall@1 | 0.2696 |
| cosine_recall@3 | 0.7167 |
| cosine_recall@5 | 0.8281 |
| cosine_recall@10 | 0.919 |
| cosine_ndcg@10 | 0.827 |
| cosine_mrr@10 | 0.7724 |
| cosine_map@100 | 0.8016 |
dim_256{
"truncate_dim": 256
}
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.7177 |
| cosine_accuracy@3 | 0.7604 |
| cosine_accuracy@5 | 0.8505 |
| cosine_accuracy@10 | 0.9223 |
| cosine_precision@1 | 0.7177 |
| cosine_precision@3 | 0.6703 |
| cosine_precision@5 | 0.474 |
| cosine_precision@10 | 0.2658 |
| cosine_recall@1 | 0.2673 |
| cosine_recall@3 | 0.7086 |
| cosine_recall@5 | 0.8179 |
| cosine_recall@10 | 0.9152 |
| cosine_ndcg@10 | 0.8209 |
| cosine_mrr@10 | 0.765 |
| cosine_map@100 | 0.7947 |
dim_128{
"truncate_dim": 128
}
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.6901 |
| cosine_accuracy@3 | 0.732 |
| cosine_accuracy@5 | 0.8338 |
| cosine_accuracy@10 | 0.9095 |
| cosine_precision@1 | 0.6901 |
| cosine_precision@3 | 0.6427 |
| cosine_precision@5 | 0.4603 |
| cosine_precision@10 | 0.2608 |
| cosine_recall@1 | 0.2578 |
| cosine_recall@3 | 0.6807 |
| cosine_recall@5 | 0.7959 |
| cosine_recall@10 | 0.8988 |
| cosine_ndcg@10 | 0.7991 |
| cosine_mrr@10 | 0.7398 |
| cosine_map@100 | 0.7726 |
| positive | anchor | |
|---|---|---|
| type | string | string |
| details | <ul><li>min: 110 tokens</li><li>mean: 204.39 tokens</li><li>max: 313 tokens</li></ul> | <ul><li>min: 19 tokens</li><li>mean: 36.62 tokens</li><li>max: 91 tokens</li></ul> |
| positive | anchor |
|---|---|
| <code>Điều 7. Cấp chứng chỉ<br>1. Người học được cơ sở đào tạo cấp Chứng chỉ đào tạo nghiệp vụ giám định pháp y hoặc giám định pháp y tâm thần khi đáp ứng đủ các yêu cầu sau đây:<br>a) Không vi phạm các quy định của khóa đào tạo;<br>b) Tham gia đầy đủ thời gian đào tạo và tích lũy đủ nội dung của chương trình đào tạo;<br>c) Kết quả kiểm tra, đánh giá năng lực đạt yêu cầu của khóa đào tạo;<br>d) Hoàn thành đầy đủ các nghĩa vụ của người học đối với cơ sở đào tạo.<br>2. Mẫu Chứng chỉ đào tạo nghiệp vụ giám định pháp y hoặc nghiệp vụ giám định pháp y tâm thần được quy định tại Phụ lục ban hành kèm theo Thông tư này.<br>3. Chứng chỉ đào tạo nghiệp vụ giám định pháp y và đào tạo nghiệp vụ giám định pháp y tâm thần là một trong những điều kiện để bổ nhiệm giám định viên tư pháp trong lĩnh vực pháp y và pháp y tâm thần theo quy định của Luật giám định tư pháp.</code> | <code>Luật giám định tư pháp quy định những điều kiện gì để bổ nhiệm giám định viên tư pháp trong lĩnh vực pháp y và pháp y tâm thần?</code> |
| <code>Điều 68. Nguyên tắc quản lý, sử dụng<br>1. Người làm công tác thi hành án dân sự phải mặc trang phục có gắn bảng tên, phù hiệu, cấp hiệu thi hành án dân sự tại công sở và trong khi thi hành công vụ theo đúng chức vụ, chức danh đang đảm nhiệm.<br>2. Việc cấp phát, quản lý, sử dụng trang phục, phù hiệu, cấp hiệu, Thẻ Chấp hành viên, Thẻ Thẩm tra viên thi hành án phải đúng mục đích, đúng đối tượng, đúng chế độ theo quy định của pháp luật.<br>3. Nghiêm cấm việc sử dụng trang phục, phù hiệu, cấp hiệu, Thẻ Chấp hành viên, Thẻ Thẩm tra viên thi hành án để thực hiện các hành vi trái pháp luật.</code> | <code>Việc sử dụng trang phục, phù hiệu, cấp hiệu, Thẻ Chấp hành viên, Thẻ Thẩm tra viên thi hành án để thực hiện các hành vi trái pháp luật bị nghiêm cấm như thế nào?</code> |
| <code>Điều 8. Trách nhiệm của cơ sở cung cấp dịch vụ công tác xã hội<br>1. Thường xuyên tổ chức giáo dục ý thức tuân thủ các quy định về tiêu chuẩn đạo đức nghề nghiệp đối với người làm công tác xã hội thuộc phạm vi quản lý.<br>2. Phối hợp với các cơ sở đào tạo, cơ sở giáo dục nghề nghiệp để đào tạo, bồi dưỡng, nâng cao năng lực chuyên môn và đạo đức nghề nghiệp đối với người làm công tác xã hội.<br>3. Công bố công khai tiêu chuẩn đạo đức nghề công tác xã hội để người làm công tác xã hội biết và nghiêm túc thực hiện.<br>4. Tạo điều kiện thuận lợi và hỗ trợ để người làm công tác xã hội thực hiện tốt các tiêu chuẩn đạo đức nghề nghiệp trong quá trình thực hành công tác xã hội.<br>5. Tiếp nhận, giải quyết các khiếu nại, tố cáo của đối tượng liên quan đến việc thực hiện đạo đức nghề nghiệp của người làm công tác xã hội theo thẩm quyền; xử lý nghiêm các hành vi vi phạm đạo đức nghề nghiệp thuộc phạm vi quản lý theo quy định của pháp luật.<br>6. Thường xuyên kiểm tra, đánh giá kết quả việc thực hiện tiêu chuẩn đạo ...</code> | <code>Các cơ sở cung cấp dịch vụ công tác xã hội phải làm gì để đảm bảo người làm công tác xã hội tuân thủ đạo đức nghề nghiệp?</code> |
{
"loss": "MultipleNegativesRankingLoss",
"matryoshka_dims": [
1024,
768,
512,
256,
128
],
"matryoshka_weights": [
1,
1,
1,
1,
1
],
"n_dims_per_step": -1
}
eval_strategy: epochper_device_train_batch_size: 64per_device_eval_batch_size: 64gradient_accumulation_steps: 8learning_rate: 3e-05num_train_epochs: 4lr_scheduler_type: cosinewarmup_ratio: 0.1fp16: Truetf32: Truedataloader_num_workers: 8load_best_model_at_end: Trueoptim: adamw_torch_fusedddp_find_unused_parameters: Falsebatch_sampler: no_duplicatesoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: epochprediction_loss_only: Trueper_device_train_batch_size: 64per_device_eval_batch_size: 64per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 8eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 3e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 4max_steps: -1lr_scheduler_type: cosinelr_scheduler_kwargs: {}warmup_ratio: 0.1warmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Truesave_safetensors: Truesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseno_cuda: Falseuse_cpu: Falseuse_mps_device: Falseseed: 42data_seed: Nonejit_mode_eval: Falseuse_ipex: Falsebf16: Falsefp16: Truefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Truelocal_rank: 0ddp_backend: Nonetpu_num_cores: Nonetpu_metrics_debug: Falsedebug: []dataloader_drop_last: Falsedataloader_num_workers: 8dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Trueignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}deepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthddp_find_unused_parameters: Falseddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Trueuse_legacy_prediction_loop: Falsepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_do_concat_batches: Truefp16_backend: autopush_to_hub_model_id: Nonepush_to_hub_organization: Nonemp_parameters:auto_find_batch_size: Falsefull_determinism: Falsetorchdynamo: Noneray_scope: lastddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportional| Epoch | Step | Training Loss | dim_1024_cosine_ndcg@10 | dim_768_cosine_ndcg@10 | dim_512_cosine_ndcg@10 | dim_256_cosine_ndcg@10 | dim_128_cosine_ndcg@10 |
|---|---|---|---|---|---|---|---|
| 0.2210 | 10 | 5.7308 | - | - | - | - | - |
| 0.4420 | 20 | 2.5237 | - | - | - | - | - |
| 0.6630 | 30 | 2.1593 | - | - | - | - | - |
| 0.8840 | 40 | 1.741 | - | - | - | - | - |
| 1.0 | 46 | - | 0.8236 | 0.8186 | 0.8173 | 0.8095 | 0.7822 |
| 1.0884 | 50 | 1.4595 | - | - | - | - | - |
| 1.3094 | 60 | 1.3117 | - | - | - | - | - |
| 1.5304 | 70 | 1.2627 | - | - | - | - | - |
| 1.7514 | 80 | 1.07 | - | - | - | - | - |
| 1.9724 | 90 | 1.03 | - | - | - | - | - |
| 2.0 | 92 | - | 0.8302 | 0.8300 | 0.8260 | 0.8177 | 0.7981 |
| 2.1768 | 100 | 0.8494 | - | - | - | - | - |
| 2.3978 | 110 | 1.0987 | - | - | - | - | - |
| 2.6188 | 120 | 0.8031 | - | - | - | - | - |
| 2.8398 | 130 | 0.8575 | - | - | - | - | - |
| 3.0 | 138 | - | 0.8323 | 0.8321 | 0.8259 | 0.8197 | 0.7984 |
| 3.0442 | 140 | 0.7405 | - | - | - | - | - |
| 3.2652 | 150 | 0.8546 | - | - | - | - | - |
| 3.4862 | 160 | 0.7658 | - | - | - | - | - |
| 3.7072 | 170 | 0.8311 | - | - | - | - | - |
| 3.9282 | 180 | 0.8719 | - | - | - | - | - |
| 4.0 | 184 | - | 0.8336 | 0.8328 | 0.827 | 0.8209 | 0.7991 |
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}
@misc{kusupati2024matryoshka,
title={Matryoshka Representation Learning},
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},
year={2024},
eprint={2205.13147},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
@misc{henderson2017efficient,
title={Efficient Natural Language Response Suggestion for Smart Reply},
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},
year={2017},
eprint={1705.00652},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
<!--
## Glossary
*Clearly define terms in order to be accessible across audiences.*
-->
<!--
## Model Card Authors
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->
<!--
## Model Card Contact
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->