Downloads · 30 days
9
6% of all-time downloads
MinhViet/halong_embedding_no_negatives_1epoch
halong_embedding_no_negatives_1epoch is a sentence similarity model from MinhViet. 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 hiieu/halongembedding. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, para…
Downloads · 30 days
9
6% of all-time downloads
All-time downloads
151
Public
Parameters
278M
1.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.1 GB · 98%
From the Hugging Face model README
This is a sentence-transformers model finetuned from hiieu/halong_embedding. 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.
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: XLMRobertaModel
(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})
(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("MinhViet/halong_embedding_no_negatives_1epoch")
# Run inference
sentences = [
'Phát triển cơ sở giáo dục dân lập, tư thục như thế nào?',
'Tiêu đề: Luật giáo dục 2019 \nMục: Điều 16. Xã hội hóa sự nghiệp giáo dục\nNội dung: Xã hội hóa sự nghiệp giáo dục: \n1. Phát triển giáo dục, xây dựng xã hội học tập là sự nghiệp của Nhà nước và của toàn dân.\n2. Nhà nước giữ vai trò chủ đạo trong phát triển sự nghiệp giáo dục. Thực hiện đa dạng hóa các loại hình cơ sở giáo dục và hình thức giáo dục; khuyến khích, huy động và tạo điều kiện để tổ chức, cá nhân tham gia phát triển sự nghiệp giáo dục; khuyến khích phát triển cơ sở giáo dục dân lập, tư thục đáp ứng nhu cầu xã hội về giáo dục chất lượng cao.\n3. Tổ chức, gia đình và cá nhân có trách nhiệm chăm lo sự nghiệp giáo dục, phối hợp với cơ sở giáo dục thực hiện mục tiêu giáo dục, xây dựng môi trường giáo dục an toàn, lành mạnh.\n4. Tổ chức, cá nhân có thành tích trong sự nghiệp giáo dục được khen thưởng theo quy định của pháp luật.',
'Tiêu đề: Luật giáo dục 2019 \nMục: Điều 5. Giải thích từ ngữ\nNội dung: Khối lượng kiến thức văn hóa trung học phổ thông là kiến thức, kỹ năng cơ bản, cốt lõi trong chương trình giáo dục trung học phổ thông mà người học phải tích lũy để có thể tiếp tục học trình độ giáo dục nghề nghiệp cao hơn.',
]
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]
<!--
### 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.*
-->
evaluation| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.4152 |
| cosine_accuracy@3 | 0.6397 |
| cosine_accuracy@5 | 0.7289 |
| cosine_accuracy@10 | 0.8243 |
| cosine_precision@1 | 0.4152 |
| cosine_precision@3 | 0.2597 |
| cosine_precision@5 | 0.1935 |
| cosine_precision@10 | 0.1194 |
| cosine_recall@1 | 0.2992 |
| cosine_recall@3 | 0.523 |
| cosine_recall@5 | 0.627 |
| cosine_recall@10 | 0.7515 |
| cosine_ndcg@10 | 0.5661 |
| cosine_mrr@10 | 0.5449 |
| cosine_map@100 | 0.4959 |
| question | context | |
|---|---|---|
| type | string | string |
| details | <ul><li>min: 7 tokens</li><li>mean: 18.46 tokens</li><li>max: 41 tokens</li></ul> | <ul><li>min: 39 tokens</li><li>mean: 123.93 tokens</li><li>max: 322 tokens</li></ul> |
| question | context |
|---|---|
| <code>Mục tiêu giáo dục đại học là gì?</code> | <code>Tiêu đề: Luật giáo dục 2019 <br>Mục: Điều 2. Mục tiêu giáo dục<br>Nội dung: Mục tiêu giáo dục nhằm phát triển toàn diện con người Việt Nam có đạo đức, tri thức, văn hóa, sức khỏe, thẩm mỹ và nghề nghiệp; có phẩm chất, năng lực và ý thức công dân; có lòng yêu nước, tinh thần dân tộc, trung thành với lý tưởng độc lập dân tộc và chủ nghĩa xã hội; phát huy tiềm năng, khả năng sáng tạo của mỗi cá nhân; nâng cao dân trí, phát triển nguồn nhân lực, bồi dưỡng nhân tài, đáp ứng yêu cầu của sự nghiệp xây dựng, bảo vệ Tổ quốc và hội nhập quốc tế.</code> |
| <code>Em muốn biết về phát triển toàn diện con người Việt Nam trong giáo dục như thế nào?</code> | <code>Tiêu đề: Luật giáo dục 2019 <br>Mục: Điều 2. Mục tiêu giáo dục<br>Nội dung: Mục tiêu giáo dục nhằm phát triển toàn diện con người Việt Nam có đạo đức, tri thức, văn hóa, sức khỏe, thẩm mỹ và nghề nghiệp; có phẩm chất, năng lực và ý thức công dân; có lòng yêu nước, tinh thần dân tộc, trung thành với lý tưởng độc lập dân tộc và chủ nghĩa xã hội; phát huy tiềm năng, khả năng sáng tạo của mỗi cá nhân; nâng cao dân trí, phát triển nguồn nhân lực, bồi dưỡng nhân tài, đáp ứng yêu cầu của sự nghiệp xây dựng, bảo vệ Tổ quốc và hội nhập quốc tế.</code> |
| <code>Phát huy tiềm năng, khả năng sáng tạo của mỗi cá nhân trong giáo dục được hiểu như thế nào?</code> | <code>Tiêu đề: Luật giáo dục 2019 <br>Mục: Điều 2. Mục tiêu giáo dục<br>Nội dung: Mục tiêu giáo dục nhằm phát triển toàn diện con người Việt Nam có đạo đức, tri thức, văn hóa, sức khỏe, thẩm mỹ và nghề nghiệp; có phẩm chất, năng lực và ý thức công dân; có lòng yêu nước, tinh thần dân tộc, trung thành với lý tưởng độc lập dân tộc và chủ nghĩa xã hội; phát huy tiềm năng, khả năng sáng tạo của mỗi cá nhân; nâng cao dân trí, phát triển nguồn nhân lực, bồi dưỡng nhân tài, đáp ứng yêu cầu của sự nghiệp xây dựng, bảo vệ Tổ quốc và hội nhập quốc tế.</code> |
{
"scale": 20.0,
"similarity_fct": "cos_sim",
"mini_batch_size": 32
}
eval_strategy: epochper_device_train_batch_size: 1024per_device_eval_batch_size: 1024weight_decay: 0.0001num_train_epochs: 1batch_sampler: no_duplicatesoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: epochprediction_loss_only: Trueper_device_train_batch_size: 1024per_device_eval_batch_size: 1024per_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.0001adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 1max_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}tp_size: 0fsdp_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: no_duplicatesmulti_dataset_batch_sampler: proportional| Epoch | Step | Training Loss | evaluation_cosine_ndcg@10 |
|---|---|---|---|
| 1.0 | 20 | 1.2991 | 0.5661 |
@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{gao2021scaling,
title={Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup},
author={Luyu Gao and Yunyi Zhang and Jiawei Han and Jamie Callan},
year={2021},
eprint={2101.06983},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
<!--
## 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.*
-->