SentenceTransformer based on intfloat/multilingual-e5-large
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.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: intfloat/multilingual-e5-large
- Maximum Sequence Length: 512 tokens
- Output Dimensionality: 1024 dimensions
- Similarity Function: Cosine Similarity
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
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()
)
Usage
Direct Usage (Sentence Transformers)
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_1")
# 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]
Evaluation
Metrics
Binary Classification
- Evaluated with
BinaryClassificationEvaluator
Metric | Value |
---|---|
cosine_accuracy | 0.5184 |
cosine_accuracy_threshold | 0.7373 |
cosine_f1 | 0.682 |
cosine_f1_threshold | 0.7373 |
cosine_precision | 0.5175 |
cosine_recall | 1.0 |
cosine_ap | 0.508 |
cosine_mcc | 0.0468 |
Training Details
Training Dataset
Unnamed Dataset
- Size: 4,391 training samples
- Columns:
sentence1
,sentence2
, andlabel
- Approximate statistics based on the first 1000 samples:
sentence1 sentence2 label type string string int details - min: 7 tokens
- mean: 24.23 tokens
- max: 101 tokens
- min: 19 tokens
- mean: 242.45 tokens
- max: 512 tokens
- 0: ~48.00%
- 1: ~52.00%
- Samples:
sentence1 sentence2 label 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?
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).
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...0
Đ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
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.
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:
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;
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ủ.0
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?
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.
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ỏ.1
- Loss:
OnlineContrastiveLoss
Training Hyperparameters
Non-Default Hyperparameters
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_duplicates
All Hyperparameters
Click to expand
overwrite_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
Training Logs
Epoch | Step | Training Loss | cosine_ap |
---|---|---|---|
-1 | -1 | - | 0.7745 |
0.1821 | 200 | 0.1202 | - |
0.3643 | 400 | 0.1298 | 0.7378 |
0.5464 | 600 | 0.1436 | - |
0.7286 | 800 | 0.1546 | 0.6054 |
0.9107 | 1000 | 0.1626 | - |
1.0929 | 1200 | 0.1497 | 0.5659 |
1.2750 | 1400 | 0.1425 | - |
1.4572 | 1600 | 0.1452 | 0.5673 |
1.6393 | 1800 | 0.1478 | - |
1.8215 | 2000 | 0.1446 | 0.5610 |
2.0036 | 2200 | 0.143 | - |
2.1858 | 2400 | 0.1424 | 0.5456 |
2.3679 | 2600 | 0.1459 | - |
2.5501 | 2800 | 0.1441 | 0.5538 |
2.7322 | 3000 | 0.1407 | - |
2.9144 | 3200 | 0.1442 | 0.5452 |
3.0965 | 3400 | 0.1539 | - |
3.2787 | 3600 | 0.1407 | 0.5794 |
3.4608 | 3800 | 0.141 | - |
3.6430 | 4000 | 0.1483 | 0.5398 |
3.8251 | 4200 | 0.1507 | - |
-1 | -1 | - | 0.5080 |
Framework Versions
- Python: 3.10.14
- Sentence Transformers: 3.4.1
- Transformers: 4.41.2
- PyTorch: 2.1.2+cu121
- Accelerate: 0.34.2
- Datasets: 2.19.1
- Tokenizers: 0.19.1
Citation
BibTeX
Sentence Transformers
@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",
}
- Downloads last month
- 3
Inference Providers
NEW
This model is not currently available via any of the supported Inference Providers.
Model tree for ictumuk/mul_legal_final_1
Base model
intfloat/multilingual-e5-largeEvaluation results
- Cosine Accuracy on Unknownself-reported0.518
- Cosine Accuracy Threshold on Unknownself-reported0.737
- Cosine F1 on Unknownself-reported0.682
- Cosine F1 Threshold on Unknownself-reported0.737
- Cosine Precision on Unknownself-reported0.517
- Cosine Recall on Unknownself-reported1.000
- Cosine Ap on Unknownself-reported0.508
- Cosine Mcc on Unknownself-reported0.047