Views
No views yet
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: NewModel
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, '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("sentence_transformers_model_id")
5# Run inference
6sentences = [
7 'đồ decor ngoài trời',
8 '<p><strong>🔸Công ty Kim Vinh</strong> chuyên cung cấp các sản phẩm trang trí nội, ngoại thất chất lượng cao cho mọi không gian sống. Với đa dạng mẫu mã, từ đồ trang trí phòng khách, phòng ngủ, đến các vật dụng ngoài trời như sân vườn, ban công, <strong>Kim Vinh</strong> cam kết mang đến những sản phẩm không chỉ đẹp mắt mà còn bền vững theo thời gian.</p><p>🔸Tất cả các mặt hàng tại công ty đều có sẵn, giúp khách hàng dễ dàng lựa chọn và mua sắm nhanh chóng. Đặc biệt, <strong>Kim Vinh</strong> luôn chú trọng đến dịch vụ giao hàng nhanh chóng, đảm bảo sự hài lòng tuyệt đối cho mọi khách hàng. Chúng tôi tự hào là đối tác tin cậy của nhiều gia đình, doanh nghiệp trong việc làm đẹp không gian sống và làm việc.</p>',
9 '<p>🔸<strong>Orchard Home Forest</strong> là một khu nghỉ dưỡng sinh thái tọa lạc tại vùng ngoại ô, nơi hòa quyện giữa vẻ đẹp tự nhiên và không gian yên bình, lý tưởng cho những ai tìm kiếm sự thư giãn và tái tạo năng lượng. Với diện tích rộng lớn bao phủ bởi rừng cây xanh mát và những khu vườn trái cây trĩu quả, nơi đây mang đến cho du khách một trải nghiệm gần gũi với thiên nhiên.</p><p>🔸<strong>Orchard Home Forest</strong> không chỉ nổi bật với cảnh quan tươi đẹp, mà còn cung cấp các dịch vụ nghỉ dưỡng cao cấp, như biệt thự nghỉ dưỡng, nhà gỗ tiện nghi, các hoạt động ngoài trời như đi bộ, đạp xe và tham gia vào các chương trình chăm sóc sức khỏe, yoga. Đặc biệt, khu nghỉ dưỡng này chú trọng phát triển bền vững và bảo vệ môi trường, với các biện pháp giảm thiểu tác động đến hệ sinh thái địa phương.</p><p>🔸Những ai ghé thăm <strong>Orchard Home Forest </strong>sẽ cảm nhận được sự thư thái, tĩnh lặng, và làn gió mới cho tâm hồn, giúp tái tạo năng lượng sau những ngày làm việc căng thẳng. Đây là điểm đến lý tưởng cho những ai yêu thích sự kết hợp giữa nghỉ dưỡng và khám phá thiên nhiên.</p>',
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]query, description, and negative| query | description | negative | |
|---|---|---|---|
| type | string | string | string |
| details |
|
|
|
| query | description | negative |
|---|---|---|
mật ong probiotics | [object Object][object Object] | [object Object][object Object][object Object] |
mật ong probiotics | [object Object][object Object] | [object Object][object Object]🔸Điểm đặc biệt của [object Object]là thành phần sirô chiết xuất từ đường bắp, an toàn cho người tiểu đường và trẻ em có ... |
mật ong probiotics | [object Object][object Object] | [object Object][object Object][object Object]🔸"[object Object]" và "[object Object] [object Object]" là những danh hiệu danh giá mà [object Object] đã đạt được, khẳng ... |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim"
4}per_device_train_batch_size: 16per_device_eval_batch_size: 16learning_rate: 2e-05weight_decay: 0.01num_train_epochs: 1warmup_steps: 100fp16: Truedataloader_num_workers: 4overwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 16per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 2e-05weight_decay: 0.01adam_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: 100log_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: Truefp16_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: 4dataloader_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: Falsehub_revision: Nonegradient_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: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportional| Epoch | Step | Training Loss |
|---|---|---|
| 0.0268 | 10 | 1.9618 |
| 0.0536 | 20 | 1.8811 |
| 0.0804 | 30 | 1.8416 |
| 0.1072 | 40 | 1.7155 |
| 0.1340 | 50 | 1.5214 |
| 0.1609 | 60 | 1.6549 |
| 0.1877 | 70 | 1.5042 |
| 0.2145 | 80 | 1.3187 |
| 0.2413 | 90 | 1.3651 |
| 0.2681 | 100 | 1.1366 |
| 0.2949 | 110 | 1.2463 |
| 0.3217 | 120 | 1.1371 |
| 0.3485 | 130 | 1.1857 |
| 0.3753 | 140 | 1.1055 |
| 0.4021 | 150 | 1.1215 |
| 0.4290 | 160 | 1.206 |
| 0.4558 | 170 | 1.0617 |
| 0.4826 | 180 | 1.169 |
| 0.5094 | 190 | 1.1628 |
| 0.5362 | 200 | 1.1601 |
| 0.5630 | 210 | 1.1011 |
| 0.5898 | 220 | 0.8756 |
| 0.6166 | 230 | 1.1203 |
| 0.6434 | 240 | 0.8605 |
| 0.6702 | 250 | 0.9246 |
| 0.6971 | 260 | 0.9078 |
| 0.7239 | 270 | 1.1245 |
| 0.7507 | 280 | 0.8946 |
| 0.7775 | 290 | 0.8846 |
| 0.8043 | 300 | 0.9328 |
| 0.8311 | 310 | 1.0018 |
| 0.8579 | 320 | 0.9624 |
| 0.8847 | 330 | 0.8516 |
| 0.9115 | 340 | 0.836 |
| 0.9383 | 350 | 0.7674 |
| 0.9651 | 360 | 0.937 |
| 0.9920 | 370 | 0.9097 |
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}