Sentence Similarity
sentence-transformers
Safetensors
bert
feature-extraction
dense
Generated from Trainer
dataset_size:3872
loss:MultipleNegativesRankingLoss
Eval Results (legacy)
text-embeddings-inference
Instructions to use HarishMaths/Hotel-Policy-Embedding with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use HarishMaths/Hotel-Policy-Embedding with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("HarishMaths/Hotel-Policy-Embedding") sentences = [ "(g) If a Member wishes to extend their stay and has enough Nightly Upgrade Award(s) to cover the extension, the Member must book a separate reservation for the additional nights and request to use Nightly Upgrade Awards on Marriott Websites or by calling Member Support; the Nightly Upgrade Award request cannot be processed at the Participating Property.", "Flexible rates cancel up to a deadline the property sets.", "DONT book a non-refundable hotel without reading the cancellation policy because you must understand the exact penalty structurewhether you forfeit one night, the full amount, or a percentageto determine your coverage needs and ensure your insurance limit is adequate.", "As for semi-flexible plans, they might require notice at least five days before check-in." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
SentenceTransformer
This is a sentence-transformers model trained for semantic text understanding. It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, classification, clustering, and more.
Model Details
Model Description
- Model Type: Sentence Transformer
- Maximum Sequence Length: 128 tokens
- Output Dimensionality: 384 dimensions
- Similarity Function: Cosine Similarity
- Supported Modality: Text
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'BertModel'})
(1): Pooling({'embedding_dimension': 384, 'pooling_mode': 'mean', 'include_prompt': True})
(2): Normalize({})
)
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("HarishMaths/Hotel-Policy-Embedding")
# Run inference
sentences = [
'Smoking or vaping is allowed in designated rooms.',
'Marriott is committed to providing its guests and associates with a smoke-free environment, and is proud to boast one of the most comprehensive smoke-free hotel policies in the industry.',
'Some upgrades to Premium Rooms require payment in local currency and cannot be purchased with Points.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.9151, 0.2602],
# [0.9151, 1.0000, 0.3726],
# [0.2602, 0.3726, 1.0000]])
Evaluation
Metrics
Semantic Similarity
- Dataset:
val - Evaluated with
EmbeddingSimilarityEvaluator
| Metric | Value |
|---|---|
| pearson_cosine | 0.6244 |
| spearman_cosine | 0.6463 |
Training Details
Training Dataset
Unnamed Dataset
- Size: 3,872 training samples
- Columns:
sentence_0andsentence_1 - Approximate statistics based on the first 100 samples:
sentence_0 sentence_1 type string string modality text text details - min: 6 tokens
- mean: 24.39 tokens
- max: 117 tokens
- min: 9 tokens
- mean: 27.12 tokens
- max: 103 tokens
- Samples:
sentence_0 sentence_1 Three months after booking and 20 days after purchasing insurance, the tour operator files bankruptcy and ceases all operations.California SB 644 requires hotels and third-party booking sites to give a full refund when a guest cancels within 24 hours of booking, as long as the reservation was made at least 72 hours before check-in.One of the easiest ways to avoid resort fees is by booking an award stay.For a typical domestic Hilton hotel, it will show you the points options and cash rates all on one screen.The General Contractor went out to several Home Depot locations around the City to find over 250 battery-operated smoke detectors.Modern sensors detect vapour, and the resulting charge is identical to a cigarette violation. - Loss:
MultipleNegativesRankingLosswith these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim", "gather_across_devices": false, "directions": [ "query_to_doc" ], "partition_mode": "joint", "hardness_mode": null, "hardness_strength": 0.0 }
Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size: 32num_train_epochs: 25fp16: Trueper_device_eval_batch_size: 32multi_dataset_batch_sampler: round_robin
All Hyperparameters
Click to expand
per_device_train_batch_size: 32num_train_epochs: 25max_steps: -1learning_rate: 5e-05lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_steps: 0optim: adamw_torch_fusedoptim_args: Noneweight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08optim_target_modules: Nonegradient_accumulation_steps: 1average_tokens_across_devices: Truemax_grad_norm: 1label_smoothing_factor: 0.0bf16: Falsefp16: Truebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Nonetorch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneuse_liger_kernel: Falseliger_kernel_config: Noneuse_cache: Falseneftune_noise_alpha: Nonetorch_empty_cache_steps: Noneauto_find_batch_size: Falselog_on_each_node: Truelogging_nan_inf_filter: Trueinclude_num_input_tokens_seen: nolog_level: passivelog_level_replica: warningdisable_tqdm: Falseproject: huggingfacetrackio_space_id: Nonetrackio_bucket_id: Nonetrackio_static_space_id: Noneper_device_eval_batch_size: 32prediction_loss_only: Trueeval_on_start: Falseeval_do_concat_batches: Trueeval_use_gather_object: Falseeval_accumulation_steps: Noneinclude_for_metrics: []batch_eval_metrics: Falsesave_only_model: Falsesave_on_each_node: Falseenable_jit_checkpoint: Falsepush_to_hub: Falsehub_private_repo: Nonehub_model_id: Nonehub_strategy: every_savehub_always_push: Falsehub_revision: Noneload_best_model_at_end: Falseignore_data_skip: Falserestore_callback_states_from_checkpoint: Falsefull_determinism: Falseseed: 42data_seed: Noneuse_cpu: Falseaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedataloader_drop_last: Falsedataloader_num_workers: 0dataloader_pin_memory: Truedataloader_persistent_workers: Falsedataloader_prefetch_factor: Nonedataloader_multiprocessing_context: Nonedataloader_in_order: Trueremove_unused_columns: Truelabel_names: Nonetrain_sampling_strategy: randomlength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falseddp_static_graph: Noneddp_backend: Noneddp_timeout: 1800fsdp: Nonefsdp_config: Nonedeepspeed: Nonedebug: []skip_memory_metrics: Truedo_predict: Falseresume_from_checkpoint: Nonelocal_rank: -1prompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}warmup_ratio: None
Training Logs
| Epoch | Step | Training Loss | val_spearman_cosine |
|---|---|---|---|
| -1 | -1 | - | 0.1722 |
| 0.8264 | 100 | - | 0.2700 |
| 1.0 | 121 | - | 0.2967 |
| 1.6529 | 200 | - | 0.4105 |
| 2.0 | 242 | - | 0.4552 |
| 2.4793 | 300 | - | 0.4991 |
| 3.0 | 363 | - | 0.5376 |
| 3.3058 | 400 | - | 0.5566 |
| 4.0 | 484 | - | 0.5790 |
| 4.1322 | 500 | 3.5721 | 0.5825 |
| 4.9587 | 600 | - | 0.6156 |
| 5.0 | 605 | - | 0.6162 |
| 5.7851 | 700 | - | 0.6144 |
| 6.0 | 726 | - | 0.6166 |
| 6.6116 | 800 | - | 0.6266 |
| 7.0 | 847 | - | 0.6269 |
| 7.4380 | 900 | - | 0.6348 |
| 8.0 | 968 | - | 0.6276 |
| 8.2645 | 1000 | 2.4308 | 0.6329 |
| 9.0 | 1089 | - | 0.6336 |
| 9.0909 | 1100 | - | 0.6332 |
| 9.9174 | 1200 | - | 0.6399 |
| 10.0 | 1210 | - | 0.6381 |
| 10.7438 | 1300 | - | 0.6390 |
| 11.0 | 1331 | - | 0.6397 |
| 11.5702 | 1400 | - | 0.6446 |
| 12.0 | 1452 | - | 0.6418 |
| 12.3967 | 1500 | 2.1294 | 0.6463 |
Framework Versions
- Python: 3.13.15
- Sentence Transformers: 5.7.0
- Transformers: 5.16.1
- PyTorch: 2.11.0+cu128
- Accelerate: 1.14.0
- Datasets: 4.8.5
- Tokenizers: 0.23.1
- Downloads last month
- 294
Evaluation results
- Pearson Cosine on valself-reported0.624
- Spearman Cosine on valself-reported0.646