SentenceTransformer
This is a sentence-transformers model trained. 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.
Model Details
Model Description
- Model Type: Sentence Transformer
- Maximum Sequence Length: 384 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 384, 'do_lower_case': False, 'architecture': 'MPNetModel'})
(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()
)
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("sentence_transformers_model_id")
# Run inference
sentences = [
'electronic noise rock',
"Dead Combo. by Dead Combo. Genre: Rock; Released: 2004. Review: still applicable live precise good its used bloody loud brisk another dead sonic dynamic even stiff other unusual rhythmic most all baby two melodic sunny affable heavy vocal right potent such trying little shrill twisted hot stock noisy acoustic electronic Trevor Jackson's Output label offers the debut record from this Manhattan (by way of Finland) duo that's well-versed in both Jesus & Mary Chain jangle and stiff, propulsive rhythms.",
'IV. by Faust. Genre: Rock; Released: 2006. Review: willing huge previous young just calculating either work slick hard still major ridiculous early tripping good pretty more seven long second its better fragmented outside happy classic professional alleged completed which threatened due sonic even seeming bad other third fourth exploited minute status smashing all super important sad relieved angelic new milky left messy jumbled impossible whose inspired electronic random disturbing half cut each palatable nan',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.3686, 0.2751],
# [0.3686, 1.0000, 0.9454],
# [0.2751, 0.9454, 1.0000]])
Training Details
Training Dataset
Unnamed Dataset
- Size: 9,362 training samples
- Columns:
sentence_0,sentence_1, andsentence_2 - Approximate statistics based on the first 1000 samples:
sentence_0 sentence_1 sentence_2 type string string string details - min: 4 tokens
- mean: 9.45 tokens
- max: 25 tokens
- min: 75 tokens
- mean: 131.44 tokens
- max: 253 tokens
- min: 65 tokens
- mean: 130.26 tokens
- max: 215 tokens
- Samples:
sentence_0 sentence_1 sentence_2 house gospel country meditationAngels of Death. by Jennifer Castle. Genre: Folk/Country; Released: 2018. Review: clingy specific just work hard time home tragic long second burning poignant bouncing final rough steel rural electric breezy big conflicting instrumental resilient magical which universal divided relatable meandering inarticulate difficult sparse simple creative devastating personal two natural house similar heavy crying absurd first charming flooded trying driven down rude full least fitting inspired glass acoustic her each The Toronto singer’s album is a country and gospel-infused meditation on death and mourning that flickers between the broadly universal and the devastatingly personal.Greatest Palace Music. by Bonnie “Prince” Billy. Genre: Folk/Country; Released: 2004. Review: bizarre human favorite young just mocking work legendary hallowed following its long his biggest haggard learned lofty chance crazy even bad soulful personal black house splattered informed perplexed first such smooth one fresh selected these greatest novel present different The first country record I ever bought was Merle Haggard's 16 Biggest Hits. Splattered into a harrowing dustbowl of ...disco country ethereal rock popWalking on a Dream. by Empire of the Sun. Genre: Electronic / Rock; Released: 2008. Review: impenetrable still just ridiculous either immediate indulgent divergent its relentless following sublime second cutting psychedelic his same unlikely odd old big ethereal chance simplistic uneasy complex material cleared which much best even cut snappy surprised high diverging grand both kind worst two middle sunny straight puzzling right first such poised new ready down little individual real overwrought meaningless full incapable these acid last late historical fitting white thematic inspired sleepy tough half trenchant each The first full-length collaboration from Australians Luke Steele of the Sleepy Jackson and Nick Littlemore of Pnau works on a grand scale as it moves between streamlined psychedelia and flamboyant dance-pop.Morning Phase. by Beck. Genre: Rock; Released: 2014. Review: favorite previous ambiguous time neutral live early good stunning more vague long playful its used following involved flat his same old ethereal which only another much alien excellent due sonic even dull alive entire comfortable straightforward overall minute less most lost two all red similar safe straight modern forthright queasy first new great working down unabashed daring heartbroken interesting one frustrating married these last fine sea indirect glass surprising On Morning Phase, Beck returns to the style and form of his 2002 singer-songwriter record Sea Change*.* Instead of a much-needed daring comeback statement, it feels more like a pointed exhale.folk warm drama pop saxophoneFear of Flying. by David Karsten Daniels. Genre: Folk/Country; Released: 2008. Review: still time live more basic long second its available scraggly born final his royal physical biggest familiar old fifth single musical away complex sharp former well only light universal which rustic compelling even cut female nice powerful halting devastating flying warm kind slow black all most blasphemous life every baby limited real trying left vigorous down lyrical modest one unfettered raging catastrophic particular inspired weary north otherwise David Karsten Daniels' latest is a collection of songs inspired by his grandparents' physical decline, songs that flip thoughtfully through some complex, if well-thumbed, existential issues: mortality, God, and the struggle for faith.Stay Gold. by First Aid Kit. Genre: Folk/Country; Released: 2014. Review: dusty still day work unromantic just hard inviting gold home literary good wide more its outside motivational his winning affectionate popular undeniable big musical ideal mission evening even high other third soaring most choice both kind signed two natural all warm sunny first consistent new down mature these least male stoic weary convinced her each green Swedish folk-pop duo First Aid Kit's third LP and first for Columbia is their grandest and arguably their most consistent release to date, featuring weary songs about transience that approach their conflicts with wiseness and maturity. - Loss:
TripletLosswith these parameters:{ "distance_metric": "cosine_distance_func", "triplet_margin": 0.2 }
Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size: 32per_device_eval_batch_size: 32num_train_epochs: 2multi_dataset_batch_sampler: round_robin
All Hyperparameters
Click to expand
overwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 32per_device_eval_batch_size: 32per_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.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1num_train_epochs: 2max_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: 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}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}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_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: noneftune_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: Trueprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}
Training Logs
| Epoch | Step | Training Loss |
|---|---|---|
| 1.7065 | 500 | 0.137 |
Framework Versions
- Python: 3.12.12
- Sentence Transformers: 5.1.2
- Transformers: 4.57.2
- PyTorch: 2.9.0+cu126
- Accelerate: 1.12.0
- Datasets: 4.0.0
- Tokenizers: 0.22.1
Citation
BibTeX
Sentence Transformers
@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",
}
TripletLoss
@misc{hermans2017defense,
title={In Defense of the Triplet Loss for Person Re-Identification},
author={Alexander Hermans and Lucas Beyer and Bastian Leibe},
year={2017},
eprint={1703.07737},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
- Downloads last month
- 136