SentenceTransformer based on keepitreal/vietnamese-sbert

This is a sentence-transformers model finetuned from keepitreal/vietnamese-sbert. It maps sentences & paragraphs to a 768-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: keepitreal/vietnamese-sbert
  • Maximum Sequence Length: 256 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity

Model Sources

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, 'include_prompt': True})
)

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("sentence_transformers_model_id")
# Run inference
sentences = [
    'Việc kiểm định chất lượng đầu vào công chức tổ chức hằng năm như thế nào?',
    '. Việc kiểm định chất lượng đầu vào công chức được tổ chức định kỳ lần vào tháng và tháng hàng năm.',
    '. Cơ sở mua bán, xuất khẩu, nhập khẩu, chuyển nhượng trang thiết bị y tế, nguyên liệu sản xuất, chất ngoại kiểm có chứa chất ma túy và tiền chất có trách nhiệm báo cáo gửi Bộ Y tế và gửi Bộ Công an theo định kỳ hằng năm trước ngày tháng của năm tiếp theo.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]

Evaluation

Metrics

Triplet

Metric Value
cosine_accuracy 0.9547

Training Details

Training Dataset

Unnamed Dataset

  • Size: 32,292 training samples
  • Columns: sentence_0, sentence_1, and sentence_2
  • Approximate statistics based on the first 1000 samples:
    sentence_0 sentence_1 sentence_2
    type string string string
    details
    • min: 14 tokens
    • mean: 25.26 tokens
    • max: 55 tokens
    • min: 15 tokens
    • mean: 113.16 tokens
    • max: 256 tokens
    • min: 24 tokens
    • mean: 116.68 tokens
    • max: 256 tokens
  • Samples:
    sentence_0 sentence_1 sentence_2
    Nhiệm vụ, quyền hạn của cơ quan thanh tra ở cơ quan thuộc Chính phủ như thế nào? . Cơ quan thanh tra ở cơ quan thuộc Chính phủ thực hiện nhiệm vụ thanh tra trong phạm vi quản lý của cơ quan thuộc Chính phủ. . Sỹ quan máy trực ca có nhiệm vụ sau đây: a) Điều hành thợ máy, sỹ quan kỹ thuật điện, thợ kỹ thuật điện; thường xuyên theo dõi chế độ làm việc của các máy, thiết bị, lò, nồi hơi theo đúng quy trình kỹ thuật; b) Tổ chức thực hiện nhiệm vụ của ca trực ở buồng máy, buồng lò, bảo đảm trật tự và vệ sinh công nghiệp ở buồng máy; c) Bảo đảm các máy móc thuộc bộ phận máy hoạt động bình thường, an toàn và xử lý kịp thời các sự cố xảy ra; d) Theo dõi công việc sửa chữa của những người trên bờ xuống tàu làm việc thuộc bộ phận mình phụ trách, bảo đảm an toàn lao động, phòng chống cháy nổ, an toàn kỹ thuật cho tàu và phòng ngừa ô nhiễm môi trường; đ) Theo dõi tiêu hao nhiên liệu, sử dụng các vật tư kỹ thuật của tàu; e) Tiến hành đo dầu, nước ở các két; bơm nước la canh buồng máy, nước dằn, nhiên liệu để điều chỉnh tàu theo yêu cầu của sỹ quan boong trực ca; khi tiến hành bơm nước thải các loại phải thực hiện theo đúng quy định; g) Khi tàu hành trình, sỹ quan máy trực ca có nhiệm vụ thực hiện nghi...
    Trách nhiệm của thương nhân, tổ chức cung cấp dịch vụ sàn giao dịch thương mại điện tử được quy định như thế nào? . Nhà đầu tư có hoạt động đầu tư vào doanh nghiệp nhỏ và vừa khởi nghiệp sáng tạo theo quy định của pháp luật về hỗ trợ doanh nghiệp nhỏ và vừa không phải thực hiện quy định tại Điều này.”. Sửa đổi, bổ sung như sau:“. Tổ chức thực hiện. Bộ Công Thương có trách nhiệm: a) Thực hiện quản lý hoạt động thương mại điện tử, thúc đẩy chuyển đổi số trong lĩnh vực thương mại; b) Phối hợp với Bộ Thông tin và Truyền thông, Bộ Công an trong bảo vệ an toàn thông tin, an ninh mạng đối với hoạt động thương mại điện tử. Kiến nghị Bộ Công an xử lý theo pháp luật đối với các hành vi vi phạm về an ninh mạng trong thương mại điện tử; c) Tổ chức thông tin, phổ biến, truyền thông về pháp luật liên quan đến hoạt động thương mại điện tử; d) Thanh tra, kiểm tra, giải quyết khiếu nại và xử lý vi phạm về hoạt động thương mại điện tử; đ) Hướng dẫn, kiểm tra việc tổ chức thực hiện Nghị định này. . Trong Thông tư này, tỷ lệ tổn thương cơ thể (sau đây được gọi tắt là: TTCT) được dùng chung cho tỷ lệ suy giảm khả năng lao động, tỷ lệ thương tích, tỷ lệ thương tật, tỷ lệ bệnh tật, tỷ lệ tổn hại sức khỏe.
    2. Không đi nghĩa vụ quân sự theo lệnh gọi nhập ngũ bị xử phạt hành chính như thế nào? . Bổ sung vào sau “. Hình thức xử phạt. Đối với mỗi hành vi vi phạm hành chính trong lĩnh vực quốc phòng, cơ yếu, tổ chức, cá nhân phải chịu hình thức xử phạt chính là cảnh cáo hoặc phạt tiền. . Người nào không chấp hành đúng quy định của pháp luật về đăng ký nghĩa vụ quân sự, không chấp hành lệnh gọi nhập ngũ, lệnh gọi tập trung huấn luyện, đã bị xử phạt hành chính về hành vi này hoặc đã bị kết án về tội này, chưa được xoá án tích mà còn vi phạm, thì bị phạt cải tạo không giam giữ đến hai năm hoặc phạt tù từ ba tháng đến hai năm.
  • Loss: TripletLoss with these parameters:
    {
        "distance_metric": "TripletDistanceMetric.COSINE",
        "triplet_margin": 0.3
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 32
  • multi_dataset_batch_sampler: round_robin

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • prediction_loss_only: True
  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 32
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 5e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1
  • num_train_epochs: 3
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.0
  • warmup_steps: 0
  • log_level: passive
  • log_level_replica: warning
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • save_safetensors: True
  • save_on_each_node: False
  • save_only_model: False
  • restore_callback_states_from_checkpoint: False
  • no_cuda: False
  • use_cpu: False
  • use_mps_device: False
  • seed: 42
  • data_seed: None
  • jit_mode_eval: False
  • use_ipex: False
  • bf16: False
  • fp16: False
  • fp16_opt_level: O1
  • half_precision_backend: auto
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • local_rank: 0
  • ddp_backend: None
  • tpu_num_cores: None
  • tpu_metrics_debug: False
  • debug: []
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_prefetch_factor: None
  • past_index: -1
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: False
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_min_num_params: 0
  • fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • skip_memory_metrics: True
  • use_legacy_prediction_loop: False
  • push_to_hub: False
  • resume_from_checkpoint: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_private_repo: None
  • hub_always_push: False
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • include_for_metrics: []
  • eval_do_concat_batches: True
  • fp16_backend: auto
  • push_to_hub_model_id: None
  • push_to_hub_organization: None
  • mp_parameters:
  • auto_find_batch_size: False
  • full_determinism: False
  • torchdynamo: None
  • ray_scope: last
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • include_tokens_per_second: False
  • include_num_input_tokens_seen: False
  • neftune_noise_alpha: None
  • optim_target_modules: None
  • batch_eval_metrics: False
  • eval_on_start: False
  • use_liger_kernel: False
  • eval_use_gather_object: False
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: round_robin

Training Logs

Epoch Step Training Loss ai-job-validation_cosine_accuracy
-1 -1 - 0.6577
0.1980 200 - 0.8359
0.3960 400 - 0.9021
0.4950 500 0.1213 -
0.5941 600 - 0.9176
0.7921 800 - 0.9388
0.9901 1000 0.0303 0.9411
1.0 1010 - 0.9463
1.1881 1200 - 0.9437
1.3861 1400 - 0.9530
1.4851 1500 0.0135 -
1.5842 1600 - 0.9494
1.7822 1800 - 0.9547

Framework Versions

  • Python: 3.11.13
  • Sentence Transformers: 4.1.0
  • Transformers: 4.52.4
  • PyTorch: 2.6.0+cu124
  • Accelerate: 1.8.1
  • Datasets: 3.6.0
  • Tokenizers: 0.21.2

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",
}

TripletLoss

@misc{hermans2017defense,
    title={In Defense of the Triplet Loss for Person Re-Identification},
    author={Alexander Hermans and Lucas Beyer and Bastian Leibe},
    year={2017},
    eprint={1703.07737},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}
Downloads last month
7
Safetensors
Model size
135M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Hkyun/legalkeeepitreal_v2

Finetuned
(22)
this model

Evaluation results