Downloads · 30 days
60
15% of all-time downloads
ictumuk/mul_legal_final
mul_legal_final is a sentence similarity model from ictumuk. Use it when you need a score for how close two texts are. It is set up for sentence-transformers.
This is a sentence-transformers model finetuned from intfloat/multilingual-e5-large. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic se…
Downloads · 30 days
60
15% of all-time downloads
All-time downloads
389
Public
Parameters
560M
2.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.2 GB · 99%
From the Hugging Face model README
This is a sentence-transformers model finetuned from intfloat/multilingual-e5-large. 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': 512, 'do_lower_case': False}) with Transformer model: XLMRobertaModel
(1): Pooling({'word_embedding_dimension': 1024, '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})
(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("ictumuk/mul_legal_final")
# Run inference
sentences = [
'Chế độ giáo dục phạm nhân dưới 18 tuổi từ năm 2020 được quy định như thế nào?',
'1. Phạm nhân là người dưới 18 tuổi được giam giữ theo chế độ riêng phù hợp với sức khỏe, giới tính và đặc điểm nhân thân.\n2. Trại giam có trách nhiệm giáo dục phạm nhân là người dưới 18 tuổi về văn hóa, pháp luật và dạy nghề phù hợp với độ tuổi, học vấn, giới tính và sức khỏe, chuẩn bị điều kiện để họ hòa nhập cộng đồng sau khi chấp hành xong án phạt tù. Thực hiện phổ cập giáo dục tiểu học và giáo dục trung học cơ sở. Giáo dục tiểu học là bắt buộc đối với phạm nhân chưa học xong chương trình tiểu học.',
'1. Công tác nạo vét duy tu luồng hàng hải công cộng và luồng đường thủy nội địa sử dụng nguồn ngân sách nhà nước do Bộ Giao thông vận tải, Ủy ban nhân dân cấp tỉnh quản lý được nhà nước bảo đảm, bố trí từ nguồn vốn ngân sách hàng năm để thực hiện.\n2. Không thực hiện việc bảo hành và mua bảo hiểm thi công công trình nạo vét duy tu luồng hàng hải công cộng và luồng đường thủy nội địa.',
]
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.*
-->
| Metric | Value |
|---|---|
| cosine_accuracy | 0.7746 |
| cosine_accuracy_threshold | 0.2383 |
| cosine_f1 | 0.7914 |
| cosine_f1_threshold | 0.1769 |
| cosine_precision | 0.7237 |
| cosine_recall | 0.873 |
| cosine_ap | 0.8358 |
| cosine_mcc | 0.5332 |
| sentence1 | sentence2 | label | |
|---|---|---|---|
| type | string | string | int |
| details | <ul><li>min: 7 tokens</li><li>mean: 24.23 tokens</li><li>max: 101 tokens</li></ul> | <ul><li>min: 19 tokens</li><li>mean: 242.45 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>0: ~48.00%</li><li>1: ~52.00%</li></ul> |
| sentence1 | sentence2 | label |
|---|---|---|
| <code>Gửi hồ sơ giả mạo đến kho bạc nhà nước để chi cho chương trình mục tiêu quốc gia phạt bao nhiêu?</code> | <code>1. Phạt tiền từ 10.000.000 đồng đến 15.000.000 đồng đối với hành vi lập hồ sơ, chứng từ giả mạo gửi Kho bạc Nhà nước để thanh toán, chi trả các khoản chi thường xuyên, chi sự nghiệp có tính chất thường xuyên, chi chương trình mục tiêu quốc gia, chương trình mục tiêu sử dụng kinh phí sự nghiệp (loại trừ các khoản chi thực hiện các công trình sửa chữa, bảo trì, cải tạo, nâng cấp, mở rộng cơ sở vật chất từ nguồn kinh phí chi thường xuyên ngân sách nhà nước và nguồn phí được để lại theo chế độ quy định để chi thường xuyên có tổng mức đầu tư trên 500.000.000 đồng).<br>2. Phạt tiền từ 30.000.000 đồng đến 50.000.000 đồng đối với hành vi lập hồ sơ, chứng từ giả mạo gửi Kho bạc Nhà nước để thanh toán vốn đầu tư thuộc nguồn vốn ngân sách nhà nước và nguồn vốn đầu tư từ ngân sách nhà nước thực hiện các chương trình mục tiêu hoặc chi thực hiện các công trình sửa chữa, bảo trì, cải tạo, nâng cấp, mở rộng cơ sở vật chất từ nguồn kinh phí chi thường xuyên ngân sách nhà nước và nguồn phí được để lại theo...</code> | <code>0</code> |
| <code>Điều kiện tham gia hoạt động điều tra, khảo sát, rà phá bom mìn vật nổ sau chiến tranh theo quy định hiện hành</code> | <code>1. Việc quản lý chi phí dự án được thực hiện theo quy định của pháp luật về quản lý chi phí đầu tư xây dựng công trình và theo thỏa thuận với nhà tài trợ nước ngoài.<br>2. Chi phí nhân công trong hoạt động điều tra, khảo sát, rà phá bom mìn vật nổ sau chiến tranh thực hiện như sau:<br>a) Chi phí tiền công và các khoản phụ cấp đối với các đối tượng không hưởng lương từ ngân sách nhà nước khi tham gia hoạt động điều tra, khảo sát, rà phá bom mìn vật nổ sau chiến tranh;<br>b) Chi phí bồi dưỡng đối với các đối tượng hưởng lương từ ngân sách nhà nước khi tham gia hoạt động điều tra, khảo sát, rà phá bom mìn vật nổ sau chiến tranh theo quyết định của Thủ tướng Chính phủ.</code> | <code>0</code> |
| <code>Hiệu lực pháp lý của di chúc miệng khi người lập di chúc phục hồi sức khỏe?</code> | <code>1. Trường hợp tính mạng một người bị cái chết đe dọa và không thể lập di chúc bằng văn bản thì có thể lập di chúc miệng.<br>2. Sau 03 tháng, kể từ thời điểm di chúc miệng mà người lập di chúc còn sống, minh mẫn, sáng suốt thì di chúc miệng mặc nhiên bị hủy bỏ.</code> | <code>1</code> |
{
"scale": 20.0,
"similarity_fct": "pairwise_cos_sim"
}
eval_strategy: stepsper_device_train_batch_size: 4per_device_eval_batch_size: 4learning_rate: 2e-05num_train_epochs: 4warmup_ratio: 0.1fp16: Truebatch_sampler: no_duplicatesoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 4per_device_eval_batch_size: 4per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonelearning_rate: 2e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 4max_steps: -1lr_scheduler_type: linearlr_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: Nonelocal_rank: 0ddp_backend: Nonetpu_num_cores: Nonetpu_metrics_debug: Falsedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_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_torchoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthddp_find_unused_parameters: Noneddp_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: Falsehub_always_push: Falsegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseeval_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: Nonedispatch_batches: Nonesplit_batches: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseprompts: Nonebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportional| Epoch | Step | Training Loss | cosine_ap |
|---|---|---|---|
| -1 | -1 | - | 0.7745 |
| 0.1821 | 200 | 0.9978 | - |
| 0.3643 | 400 | 1.0744 | 0.8190 |
| 0.5464 | 600 | 1.1956 | - |
| 0.7286 | 800 | 1.4955 | 0.7235 |
| 0.9107 | 1000 | 1.2426 | - |
| 1.0929 | 1200 | 1.2702 | 0.7977 |
| 1.2750 | 1400 | 1.2558 | - |
| 1.4572 | 1600 | 1.056 | 0.7980 |
| 1.6393 | 1800 | 1.2258 | - |
| 1.8215 | 2000 | 1.2263 | 0.8113 |
| 2.0036 | 2200 | 1.4364 | - |
| 2.1858 | 2400 | 0.6514 | 0.8213 |
| 2.3679 | 2600 | 0.6806 | - |
| 2.5501 | 2800 | 0.7986 | 0.8362 |
| 2.7322 | 3000 | 0.759 | - |
| 2.9144 | 3200 | 0.7518 | 0.8382 |
| 3.0965 | 3400 | 0.4201 | - |
| 3.2787 | 3600 | 0.4148 | 0.8318 |
| 3.4608 | 3800 | 0.3349 | - |
| 3.6430 | 4000 | 0.3162 | 0.8415 |
| 3.8251 | 4200 | 0.3247 | - |
| -1 | -1 | - | 0.8358 |
@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",
}
@online{kexuefm-8847,
title={CoSENT: A more efficient sentence vector scheme than Sentence-BERT},
author={Su Jianlin},
year={2022},
month={Jan},
url={https://kexue.fm/archives/8847},
}
<!--
## 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.*
-->