Views
No views yet
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()
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("TuanNM171284/TuanNM171284-HaLong-embedding-medical-v3")
5# Run inference
6sentences = [
7 'Nếu một con bò có hành vi bất thường, khó khăn khi di chuyển và bị giảm thể trọng, đó có thể là dấu hiệu của bệnh gì?',
8 'Nếu một con bò có các biểu hiện như hành vi bất thường, khó khăn trong di chuyển và giảm thể trọng, đó có thể là dấu hiệu của bệnh bò điên (Bovine Spongiform Encephalopathy - BSE).',
9 'Trong giai đoạn viêm tấy cấp tính khi bị giãn dây chằng, người bệnh tuyệt đối không được chườm nóng, xoa dầu nóng, rượu thuốc vì có thể làm tổn thương nặng hơn. Đồng thời, không vận động vùng tổn thương và không được tiêm kháng viêm trực tiếp vào vùng tổn thương.',
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 768]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities.shape)
18# [3, 3]dim_768InformationRetrievalEvaluator with these parameters:
1{
2 "truncate_dim": 768
3}| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.7276 |
| cosine_accuracy@3 | 0.9563 |
| cosine_accuracy@5 | 0.9785 |
| cosine_accuracy@10 | 0.9936 |
| cosine_precision@1 | 0.7276 |
| cosine_precision@3 | 0.3188 |
| cosine_precision@5 | 0.1957 |
| cosine_precision@10 | 0.0994 |
| cosine_recall@1 | 0.7276 |
| cosine_recall@3 | 0.9563 |
| cosine_recall@5 | 0.9785 |
| cosine_recall@10 | 0.9936 |
| cosine_ndcg@10 | 0.8834 |
| cosine_mrr@10 | 0.8458 |
| cosine_map@100 | 0.8461 |
dim_512InformationRetrievalEvaluator with these parameters:
1{
2 "truncate_dim": 512
3}| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.7283 |
| cosine_accuracy@3 | 0.9578 |
| cosine_accuracy@5 | 0.9797 |
| cosine_accuracy@10 | 0.9926 |
| cosine_precision@1 | 0.7283 |
| cosine_precision@3 | 0.3193 |
| cosine_precision@5 | 0.1959 |
| cosine_precision@10 | 0.0993 |
| cosine_recall@1 | 0.7283 |
| cosine_recall@3 | 0.9578 |
| cosine_recall@5 | 0.9797 |
| cosine_recall@10 | 0.9926 |
| cosine_ndcg@10 | 0.8839 |
| cosine_mrr@10 | 0.8467 |
| cosine_map@100 | 0.8472 |
dim_256InformationRetrievalEvaluator with these parameters:
1{
2 "truncate_dim": 256
3}| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.7336 |
| cosine_accuracy@3 | 0.9644 |
| cosine_accuracy@5 | 0.9831 |
| cosine_accuracy@10 | 0.9938 |
| cosine_precision@1 | 0.7336 |
| cosine_precision@3 | 0.3215 |
| cosine_precision@5 | 0.1966 |
| cosine_precision@10 | 0.0994 |
| cosine_recall@1 | 0.7336 |
| cosine_recall@3 | 0.9644 |
| cosine_recall@5 | 0.9831 |
| cosine_recall@10 | 0.9938 |
| cosine_ndcg@10 | 0.8881 |
| cosine_mrr@10 | 0.8518 |
| cosine_map@100 | 0.8522 |
dim_128InformationRetrievalEvaluator with these parameters:
1{
2 "truncate_dim": 128
3}| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.733 |
| cosine_accuracy@3 | 0.9616 |
| cosine_accuracy@5 | 0.9817 |
| cosine_accuracy@10 | 0.9941 |
| cosine_precision@1 | 0.733 |
| cosine_precision@3 | 0.3205 |
| cosine_precision@5 | 0.1963 |
| cosine_precision@10 | 0.0994 |
| cosine_recall@1 | 0.733 |
| cosine_recall@3 | 0.9616 |
| cosine_recall@5 | 0.9817 |
| cosine_recall@10 | 0.9941 |
| cosine_ndcg@10 | 0.8873 |
| cosine_mrr@10 | 0.8507 |
| cosine_map@100 | 0.851 |
dim_64InformationRetrievalEvaluator with these parameters:
1{
2 "truncate_dim": 64
3}| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.7273 |
| cosine_accuracy@3 | 0.9585 |
| cosine_accuracy@5 | 0.9802 |
| cosine_accuracy@10 | 0.9924 |
| cosine_precision@1 | 0.7273 |
| cosine_precision@3 | 0.3195 |
| cosine_precision@5 | 0.196 |
| cosine_precision@10 | 0.0992 |
| cosine_recall@1 | 0.7273 |
| cosine_recall@3 | 0.9585 |
| cosine_recall@5 | 0.9802 |
| cosine_recall@10 | 0.9924 |
| cosine_ndcg@10 | 0.8835 |
| cosine_mrr@10 | 0.8462 |
| cosine_map@100 | 0.8466 |
anchor and positive| anchor | positive | |
|---|---|---|
| type | string | string |
| details |
|
|
| anchor | positive |
|---|---|
Bệnh Addison là gì? | Bệnh Addison, còn được gọi là suy thượng thận nguyên phát, là tình trạng tuyến thượng thận không sản xuất đủ các hormone cortisol và aldosterone. |
Nguyên nhân chính gây ra bệnh Addison là gì? | Hầu hết các trường hợp bệnh Addison là do bệnh tự miễn, khi hệ thống miễn dịch tấn công nhầm tuyến thượng thận. Các nguyên nhân khác bao gồm nhiễm trùng kéo dài như bệnh lao, HIV, nhiễm nấm, và các tế bào ung thư lây lan đến tuyến thượng thận. |
Tôi thường xuyên mệt mỏi, yếu cơ, sụt cân và da bị sạm màu. Đây có thể là triệu chứng của bệnh gì? | Các triệu chứng như mệt mỏi mãn tính, yếu cơ, giảm cân, và da sẫm màu (nám, sạm đen, tàn nhang) có thể là dấu hiệu của bệnh Addison. |
MatryoshkaLoss with these parameters:
1{
2 "loss": "MultipleNegativesRankingLoss",
3 "matryoshka_dims": [
4 768,
5 512,
6 256,
7 128,
8 64
9 ],
10 "matryoshka_weights": [
11 1,
12 1,
13 1,
14 1,
15 1
16 ],
17 "n_dims_per_step": -1
18}eval_strategy: stepsper_device_eval_batch_size: 4gradient_accumulation_steps: 4learning_rate: 2e-05lr_scheduler_type: cosinewarmup_ratio: 0.1bf16: Trueload_best_model_at_end: Trueoptim: adamw_torch_fusedbatch_sampler: no_duplicatesoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 8per_device_eval_batch_size: 4per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 4eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 2e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 3max_steps: -1lr_scheduler_type: cosinelr_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: Truefp16: 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: Trueignore_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_torch_fusedoptim_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 | dim_768_cosine_ndcg@10 | dim_512_cosine_ndcg@10 | dim_256_cosine_ndcg@10 | dim_128_cosine_ndcg@10 | dim_64_cosine_ndcg@10 |
|---|---|---|---|---|---|---|---|
| 0.0551 | 10 | 0.9863 | 0.8053 | 0.8005 | 0.7821 | 0.7483 | 0.6675 |
| 0.1102 | 20 | 1.046 | 0.8175 | 0.8137 | 0.8027 | 0.7784 | 0.7122 |
| 0.1653 | 30 | 1.045 | 0.8269 | 0.8241 | 0.8172 | 0.8010 | 0.7524 |
| 0.2204 | 40 | 1.1269 | 0.8329 | 0.8309 | 0.8275 | 0.8147 | 0.7808 |
| 0.2755 | 50 | 0.5781 | 0.8390 | 0.8370 | 0.8357 | 0.8271 | 0.7991 |
| 0.3306 | 60 | 0.319 | 0.8391 | 0.8377 | 0.8379 | 0.8321 | 0.8101 |
| 0.3857 | 70 | 0.1891 | 0.8460 | 0.8454 | 0.8447 | 0.8414 | 0.8279 |
| 0.4408 | 80 | 0.2646 | 0.8514 | 0.8518 | 0.8506 | 0.8486 | 0.8335 |
| 0.4959 | 90 | 0.2737 | 0.8542 | 0.8544 | 0.8541 | 0.8514 | 0.8372 |
| 0.5510 | 100 | 0.1422 | 0.8565 | 0.8574 | 0.8564 | 0.8525 | 0.8366 |
| 0.6061 | 110 | 0.3984 | 0.8556 | 0.8555 | 0.8551 | 0.8520 | 0.8382 |
| 0.6612 | 120 | 0.443 | 0.8589 | 0.8593 | 0.8606 | 0.8565 | 0.8440 |
| 0.7163 | 130 | 0.1714 | 0.8584 | 0.8598 | 0.8610 | 0.8578 | 0.8477 |
| 0.7713 | 140 | 0.0658 | 0.8577 | 0.8583 | 0.8597 | 0.8573 | 0.8496 |
| 0.8264 | 150 | 0.2713 | 0.8597 | 0.8604 | 0.8618 | 0.8606 | 0.8519 |
| 0.8815 | 160 | 0.6141 | 0.8627 | 0.8638 | 0.8653 | 0.8623 | 0.8537 |
| 0.9366 | 170 | 0.741 | 0.8711 | 0.8709 | 0.8695 | 0.8651 | 0.8509 |
| 0.9917 | 180 | 0.1569 | 0.8694 | 0.8692 | 0.8689 | 0.8669 | 0.8545 |
| 1.0441 | 190 | 0.042 | 0.8638 | 0.8638 | 0.8657 | 0.8651 | 0.8567 |
| 1.0992 | 200 | 0.0586 | 0.8581 | 0.8587 | 0.8629 | 0.8610 | 0.8533 |
| 1.1543 | 210 | 0.2068 | 0.8616 | 0.8634 | 0.8666 | 0.8665 | 0.8588 |
| 1.2094 | 220 | 0.1943 | 0.8733 | 0.8741 | 0.8773 | 0.8747 | 0.8664 |
| 1.2645 | 230 | 0.0132 | 0.8664 | 0.8675 | 0.8704 | 0.8705 | 0.8629 |
| 1.3196 | 240 | 0.1768 | 0.8681 | 0.8696 | 0.8725 | 0.8727 | 0.8654 |
| 1.3747 | 250 | 0.1628 | 0.8772 | 0.8771 | 0.8797 | 0.8790 | 0.8716 |
| 1.4298 | 260 | 0.0547 | 0.8749 | 0.8756 | 0.8784 | 0.8783 | 0.8721 |
| 1.4848 | 270 | 0.0532 | 0.8794 | 0.8800 | 0.8826 | 0.8808 | 0.8743 |
| 1.5399 | 280 | 0.0991 | 0.8779 | 0.8785 | 0.8817 | 0.8808 | 0.8747 |
| 1.5950 | 290 | 0.0678 | 0.8763 | 0.8767 | 0.8801 | 0.8794 | 0.8735 |
| 1.6501 | 300 | 0.0354 | 0.8760 | 0.8768 | 0.8800 | 0.8793 | 0.8732 |
| 1.7052 | 310 | 0.0463 | 0.8787 | 0.8796 | 0.8825 | 0.8823 | 0.8767 |
| 1.7603 | 320 | 0.0391 | 0.8791 | 0.8799 | 0.8834 | 0.8826 | 0.8780 |
| 1.8154 | 330 | 0.0855 | 0.8777 | 0.8781 | 0.8813 | 0.8810 | 0.8763 |
| 1.8705 | 340 | 0.0339 | 0.8782 | 0.8785 | 0.8820 | 0.8816 | 0.8774 |
| 1.9256 | 350 | 0.0305 | 0.8760 | 0.8771 | 0.8814 | 0.8813 | 0.8772 |
| 1.9807 | 360 | 0.082 | 0.8784 | 0.8791 | 0.8831 | 0.8826 | 0.8791 |
| 2.0331 | 370 | 0.0791 | 0.8781 | 0.8793 | 0.8832 | 0.8832 | 0.8801 |
| 2.0882 | 380 | 0.0336 | 0.8799 | 0.8805 | 0.8845 | 0.8845 | 0.8818 |
| 2.1433 | 390 | 0.0374 | 0.8788 | 0.8799 | 0.8843 | 0.8842 | 0.8813 |
| 2.1983 | 400 | 0.0232 | 0.8779 | 0.8791 | 0.8833 | 0.8824 | 0.8808 |
| 2.2534 | 410 | 0.0276 | 0.8776 | 0.8791 | 0.8822 | 0.8822 | 0.8804 |
| 2.3085 | 420 | 0.0442 | 0.8777 | 0.8791 | 0.8830 | 0.8818 | 0.8798 |
| 2.3636 | 430 | 0.0323 | 0.8786 | 0.8798 | 0.8838 | 0.8827 | 0.8803 |
| 2.4187 | 440 | 0.0284 | 0.8823 | 0.8828 | 0.8862 | 0.8856 | 0.8826 |
| 2.4738 | 450 | 0.0275 | 0.8840 | 0.8848 | 0.8885 | 0.8874 | 0.8839 |
| 2.5289 | 460 | 0.0267 | 0.8842 | 0.8847 | 0.8892 | 0.8878 | 0.8837 |
| 2.5840 | 470 | 0.023 | 0.8838 | 0.8846 | 0.8889 | 0.8879 | 0.8839 |
| 2.6391 | 480 | 0.2072 | 0.8838 | 0.8843 | 0.8885 | 0.8879 | 0.8838 |
| 2.6942 | 490 | 0.0506 | 0.8836 | 0.8841 | 0.8882 | 0.8877 | 0.8836 |
| 2.7493 | 500 | 0.0368 | 0.8834 | 0.8838 | 0.8883 | 0.8872 | 0.8834 |
| 2.8044 | 510 | 0.0205 | 0.8832 | 0.8838 | 0.8885 | 0.8876 | 0.8836 |
| 2.8595 | 520 | 0.022 | 0.8831 | 0.8836 | 0.8880 | 0.8875 | 0.8833 |
| 2.9146 | 530 | 0.0167 | 0.8836 | 0.8840 | 0.8882 | 0.8876 | 0.8839 |
| 2.9697 | 540 | 0.0654 | 0.8834 | 0.8839 | 0.8881 | 0.8873 | 0.8835 |
1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}1@misc{kusupati2024matryoshka,
2 title={Matryoshka Representation Learning},
3 author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
4 year={2024},
5 eprint={2205.13147},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG}
8}1@misc{henderson2017efficient,
2 title={Efficient Natural Language Response Suggestion for Smart Reply},
3 author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
4 year={2017},
5 eprint={1705.00652},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}