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
- 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': 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
- Dataset:
ai-job-validation
- Evaluated with
TripletEvaluator
Metric | Value |
---|---|
cosine_accuracy | 0.9547 |
Training Details
Training Dataset
Unnamed Dataset
- Size: 32,292 training samples
- Columns:
sentence_0
,sentence_1
, andsentence_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
: stepsper_device_train_batch_size
: 32per_device_eval_batch_size
: 32multi_dataset_batch_sampler
: round_robin
All Hyperparameters
Click to expand
overwrite_output_dir
: Falsedo_predict
: Falseeval_strategy
: stepsprediction_loss_only
: Trueper_device_train_batch_size
: 32per_device_eval_batch_size
: 32per_gpu_train_batch_size
: Noneper_gpu_eval_batch_size
: Nonegradient_accumulation_steps
: 1eval_accumulation_steps
: Nonetorch_empty_cache_steps
: Nonelearning_rate
: 5e-05weight_decay
: 0.0adam_beta1
: 0.9adam_beta2
: 0.999adam_epsilon
: 1e-08max_grad_norm
: 1num_train_epochs
: 3max_steps
: -1lr_scheduler_type
: linearlr_scheduler_kwargs
: {}warmup_ratio
: 0.0warmup_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
: Falsefp16_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
: 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
: batch_samplermulti_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
Model tree for Hkyun/legalkeeepitreal_v2
Base model
keepitreal/vietnamese-sbertEvaluation results
- Cosine Accuracy on ai job validationself-reported0.955