Views
No views yet
SentenceTransformer(
(0): Transformer({'max_seq_length': 128, '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})
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("thai_food_prediction1")
5# Run inference
6sentences = [
7 'ปลาทูน่า, พริกขี้หนู, ไข่ไก่, น้ำปลา, เล็กน้อย, น้ำมันพืช',
8 'ไข่เจียวทูน่าพริกสับ',
9 'ข้าวแต๋น',
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]thai-food-evalInformationRetrievalEvaluator| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.6053 |
| cosine_accuracy@3 | 0.8421 |
| cosine_accuracy@5 | 0.9605 |
| cosine_accuracy@10 | 0.9737 |
| cosine_precision@1 | 0.6053 |
| cosine_precision@3 | 0.2807 |
| cosine_precision@5 | 0.1921 |
| cosine_recall@1 | 0.6053 |
| cosine_recall@3 | 0.8421 |
| cosine_recall@5 | 0.9605 |
| cosine_ndcg@10 | 0.7949 |
| cosine_mrr@10 | 0.736 |
| cosine_map@100 | 0.7372 |
anchor and positive| anchor | positive | |
|---|---|---|
| type | string | string |
| details |
|
|
| anchor | positive |
|---|---|
ปลาหมึก, ซีอิ๊วดำ, ผงขมิ้น, น้ำปูนใส, กระเทียมสับ, รากผักชี, พริกแดง, น้ำตาลปี๊บ, เกลือ, น้ำปลา, น้ำมะนาว | ปลาหมึกย่าง |
ไปตกหมึกมา อยากทำอะไรกินง่ายๆ ได้รสชาติของปลาหมึกแท้ๆ | ปลาหมึกย่าง |
อยากกินปลาหมึกๆ ซีฟุ้ด อร่อยๆ | ปลาหมึกย่าง |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim"
4}anchor and positive| anchor | positive | |
|---|---|---|
| type | string | string |
| details |
|
|
| anchor | positive |
|---|---|
น้ำมันพืช, กระเทียม, น้ำตาลทราย, น้ำปลา, ซีอิ๊วขาว, ซอสปรุงรส, ซีอิ๊วดำเค็ม, น้ำส้มสายชู, พริกไทย, เส้นหมี่แห้ง, ลูกชิ้น, ถั่วงอก | หมี่คลุก |
น้ำมัน, กระเทียม, หมูหมัก, เส้นใหญ่, ซีอิ้วดำ, คะน้า, กระหล่ำปลี, แครอท, ไข่เป็ด, ไข่ไก่, ผงปรุงรส, น้ำตาลทราย, ซอสหอยนางรม, ซอสปรุงรส, พริกไทย | ผัดซีอิ้วเส้นใหญ่ |
สะโพกหมู, น้ำตาลทราย, น้ำตาลปี๊บ, ซีอิ๊วขาว, เกลือ, น้ำเปล่า, ลูกผักชี, ยี่หร่า, กระเทียมไทย, สับละเอียด, น้ำมันพืช | หมูสวรรค์ |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim"
4}eval_strategy: epochper_device_train_batch_size: 24per_device_eval_batch_size: 24learning_rate: 5e-06num_train_epochs: 8warmup_ratio: 0.1load_best_model_at_end: Truebatch_sampler: no_duplicatesoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: epochprediction_loss_only: Trueper_device_train_batch_size: 24per_device_eval_batch_size: 24per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-06weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 8max_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: 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_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 | Validation Loss | thai-food-eval_cosine_ndcg@10 |
|---|---|---|---|---|
| 0.0971 | 10 | 3.2623 | - | - |
| 0.1942 | 20 | 2.7506 | - | - |
| 0.2913 | 30 | 2.45 | - | - |
| 0.3883 | 40 | 2.1205 | - | - |
| 0.4854 | 50 | 2.0216 | - | - |
| 0.5825 | 60 | 1.7865 | - | - |
| 0.6796 | 70 | 1.7075 | - | - |
| 0.7767 | 80 | 1.4338 | - | - |
| 0.8738 | 90 | 1.5122 | - | - |
| 0.9709 | 100 | 1.4975 | - | - |
| 1.0 | 103 | - | 1.0337 | 0.6411 |
| 1.0680 | 110 | 1.2398 | - | - |
| 1.1650 | 120 | 1.1619 | - | - |
| 1.2621 | 130 | 1.1641 | - | - |
| 1.3592 | 140 | 1.084 | - | - |
| 1.4563 | 150 | 0.992 | - | - |
| 1.5534 | 160 | 0.9877 | - | - |
| 1.6505 | 170 | 1.0527 | - | - |
| 1.7476 | 180 | 1.0431 | - | - |
| 1.8447 | 190 | 1.0235 | - | - |
| 1.9417 | 200 | 1.0231 | - | - |
| 2.0 | 206 | - | 0.6985 | 0.7429 |
| 2.0388 | 210 | 0.8387 | - | - |
| 2.1359 | 220 | 0.6738 | - | - |
| 2.2330 | 230 | 0.7837 | - | - |
| 2.3301 | 240 | 0.8629 | - | - |
| 2.4272 | 250 | 0.6708 | - | - |
| 2.5243 | 260 | 0.8917 | - | - |
| 2.6214 | 270 | 0.7686 | - | - |
| 2.7184 | 280 | 0.7352 | - | - |
| 2.8155 | 290 | 0.6844 | - | - |
| 2.9126 | 300 | 0.7821 | - | - |
| 3.0 | 309 | - | 0.6023 | 0.7508 |
| 3.0097 | 310 | 0.6968 | - | - |
| 3.1068 | 320 | 0.6536 | - | - |
| 3.2039 | 330 | 0.6157 | - | - |
| 3.3010 | 340 | 0.6562 | - | - |
| 3.3981 | 350 | 0.563 | - | - |
| 3.4951 | 360 | 0.6401 | - | - |
| 3.5922 | 370 | 0.6167 | - | - |
| 3.6893 | 380 | 0.5221 | - | - |
| 3.7864 | 390 | 0.5609 | - | - |
| 3.8835 | 400 | 0.6595 | - | - |
| 3.9806 | 410 | 0.5761 | - | - |
| 4.0 | 412 | - | 0.5541 | 0.7728 |
| 4.0777 | 420 | 0.4465 | - | - |
| 4.1748 | 430 | 0.4011 | - | - |
| 4.2718 | 440 | 0.4988 | - | - |
| 4.3689 | 450 | 0.5891 | - | - |
| 4.4660 | 460 | 0.6107 | - | - |
| 4.5631 | 470 | 0.5573 | - | - |
| 4.6602 | 480 | 0.5007 | - | - |
| 4.7573 | 490 | 0.4907 | - | - |
| 4.8544 | 500 | 0.4756 | - | - |
| 4.9515 | 510 | 0.5233 | - | - |
| 5.0 | 515 | - | 0.4831 | 0.7920 |
| 5.0485 | 520 | 0.4877 | - | - |
| 5.1456 | 530 | 0.5158 | - | - |
| 5.2427 | 540 | 0.4769 | - | - |
| 5.3398 | 550 | 0.4461 | - | - |
| 5.4369 | 560 | 0.4684 | - | - |
| 5.5340 | 570 | 0.347 | - | - |
| 5.6311 | 580 | 0.4203 | - | - |
| 5.7282 | 590 | 0.4448 | - | - |
| 5.8252 | 600 | 0.3725 | - | - |
| 5.9223 | 610 | 0.4598 | - | - |
| 6.0 | 618 | - | 0.4754 | 0.7938 |
| 6.0194 | 620 | 0.5246 | - | - |
| 6.1165 | 630 | 0.3768 | - | - |
| 6.2136 | 640 | 0.3567 | - | - |
| 6.3107 | 650 | 0.4294 | - | - |
| 6.4078 | 660 | 0.356 | - | - |
| 6.5049 | 670 | 0.4915 | - | - |
| 6.6019 | 680 | 0.3908 | - | - |
| 6.6990 | 690 | 0.3245 | - | - |
| 6.7961 | 700 | 0.4382 | - | - |
| 6.8932 | 710 | 0.4935 | - | - |
| 6.9903 | 720 | 0.4248 | - | - |
| 7.0 | 721 | - | 0.4928 | 0.7886 |
| 7.0874 | 730 | 0.2804 | - | - |
| 7.1845 | 740 | 0.3395 | - | - |
| 7.2816 | 750 | 0.3559 | - | - |
| 7.3786 | 760 | 0.4312 | - | - |
| 7.4757 | 770 | 0.3929 | - | - |
| 7.5728 | 780 | 0.3772 | - | - |
| 7.6699 | 790 | 0.3205 | - | - |
| 7.7670 | 800 | 0.3914 | - | - |
| 7.8641 | 810 | 0.4501 | - | - |
| 7.9612 | 820 | 0.4708 | - | - |
| 8.0 | 824 | - | 0.4766 | 0.7949 |
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{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}