SentenceTransformer based on sentence-transformers/all-mpnet-base-v2
This is a sentence-transformers model finetuned from sentence-transformers/all-mpnet-base-v2. 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
- Base model: sentence-transformers/all-mpnet-base-v2
- Maximum Sequence Length: 384 tokens
- Output Dimensionality: 768 tokens
- 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}) with Transformer model: 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("edubm/vis-sim-triplets-mpnet")
# Run inference
sentences = [
'What is the reason pie plots can work as well as bar plots in some scenarios?',
'Pie plots can work well for comparing portions a whole or portions one another, especially when dealing with a single digit count of items.',
'Thanks for your comment Tom, I do agree with you.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
Training Details
Training Dataset
Unnamed Dataset
- Size: 800 training samples
- Columns:
anchor
,positive
, andnegative
- Approximate statistics based on the first 1000 samples:
anchor positive negative type string string string details - min: 7 tokens
- mean: 15.26 tokens
- max: 41 tokens
- min: 3 tokens
- mean: 23.25 tokens
- max: 306 tokens
- min: 3 tokens
- mean: 16.38 tokens
- max: 57 tokens
- Samples:
anchor positive negative Did you ever figure out a solution to the error message problem when using your own data?
Yes, a solution was found. You have to add ' group = name ' inside the ' ggplot(aes())' like ggplot(aes(x=year, y=n,group=name)).
I recommend sorting by some feature of the data, instead of in alphabetical order of the names.
Why should you consider reordering your data when building a chart?
Reordering your data can help in better visualization. Sometimes the order of groups must be set by their features and not their values.
You should reorder your data to clean it.
What is represented on the X-axis of the chart?
The price ranges cut in several 10 euro bins.
The number of apartments per bin.
- Loss:
TripletLoss
with these parameters:{ "distance_metric": "TripletDistanceMetric.EUCLIDEAN", "triplet_margin": 5 }
Evaluation Dataset
Unnamed Dataset
- Size: 200 evaluation samples
- Columns:
anchor
,positive
, andnegative
- Approximate statistics based on the first 1000 samples:
anchor positive negative type string string string details - min: 8 tokens
- mean: 14.99 tokens
- max: 36 tokens
- min: 3 tokens
- mean: 22.38 tokens
- max: 96 tokens
- min: 3 tokens
- mean: 16.08 tokens
- max: 58 tokens
- Samples:
anchor positive negative What can be inferred about group C and B from the jittered boxplot?
Group C has a small sample size compared to the other groups. Group B seems to have a bimodal distribution with dots distributed in 2 groups: around y=18 and y=13.
Group C has the largest sample size and Group B has dots evenly distributed.
What can cause a reduction in computing time and help avoid overplotting when dealing with data?
Plotting only a fraction of your data can cause a reduction in computing time and help avoid overplotting.
Plotting all of your data is the best method to reduce computing time.
How can area charts be used for data visualization?
Area charts can be used to give a more general overview of the dataset, especially when used in combination with small multiples.
Area charts make it obvious to spot a particular group in a crowded data visualization.
- Loss:
TripletLoss
with these parameters:{ "distance_metric": "TripletDistanceMetric.EUCLIDEAN", "triplet_margin": 5 }
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy
: stepsper_device_train_batch_size
: 16per_device_eval_batch_size
: 16num_train_epochs
: 1warmup_ratio
: 0.1fp16
: True
All Hyperparameters
Click to expand
overwrite_output_dir
: Falsedo_predict
: Falseeval_strategy
: stepsprediction_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
: Nonelearning_rate
: 5e-05weight_decay
: 0.0adam_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.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
: 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
: 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}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
: Falsehub_always_push
: Falsegradient_checkpointing
: Falsegradient_checkpointing_kwargs
: Noneinclude_inputs_for_metrics
: Falseeval_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
: Nonedispatch_batches
: Nonesplit_batches
: Noneinclude_tokens_per_second
: Falseinclude_num_input_tokens_seen
: Falseneftune_noise_alpha
: Noneoptim_target_modules
: Nonebatch_eval_metrics
: Falsebatch_sampler
: batch_samplermulti_dataset_batch_sampler
: proportional
Training Logs
Epoch | Step | Training Loss | loss |
---|---|---|---|
0.02 | 1 | 4.8436 | 4.8922 |
0.04 | 2 | 4.9583 | 4.8904 |
0.06 | 3 | 4.8262 | 4.8862 |
0.08 | 4 | 4.8961 | 4.8820 |
0.1 | 5 | 4.9879 | 4.8754 |
0.12 | 6 | 4.8599 | 4.8680 |
0.14 | 7 | 4.9098 | 4.8586 |
0.16 | 8 | 4.8802 | 4.8496 |
0.18 | 9 | 4.8797 | 4.8392 |
0.2 | 10 | 4.8691 | 4.8307 |
0.22 | 11 | 4.9213 | 4.8224 |
0.24 | 12 | 4.88 | 4.8145 |
0.26 | 13 | 4.9131 | 4.8071 |
0.28 | 14 | 4.7596 | 4.8004 |
0.3 | 15 | 4.8388 | 4.7962 |
0.32 | 16 | 4.8434 | 4.7945 |
0.34 | 17 | 4.8726 | 4.7939 |
0.36 | 18 | 4.8049 | 4.7943 |
0.38 | 19 | 4.8225 | 4.7932 |
0.4 | 20 | 4.7631 | 4.7900 |
0.42 | 21 | 4.7841 | 4.7847 |
0.44 | 22 | 4.8077 | 4.7759 |
0.46 | 23 | 4.7731 | 4.7678 |
0.48 | 24 | 4.7623 | 4.7589 |
0.5 | 25 | 4.8572 | 4.7502 |
0.52 | 26 | 4.843 | 4.7392 |
0.54 | 27 | 4.6826 | 4.7292 |
0.56 | 28 | 4.7584 | 4.7180 |
0.58 | 29 | 4.7281 | 4.7078 |
0.6 | 30 | 4.7491 | 4.6982 |
0.62 | 31 | 4.7501 | 4.6897 |
0.64 | 32 | 4.6219 | 4.6826 |
0.66 | 33 | 4.7323 | 4.6768 |
0.68 | 34 | 4.5499 | 4.6702 |
0.7 | 35 | 4.7682 | 4.6648 |
0.72 | 36 | 4.6483 | 4.6589 |
0.74 | 37 | 4.6675 | 4.6589 |
0.76 | 38 | 4.7389 | 4.6527 |
0.78 | 39 | 4.7721 | 4.6465 |
0.8 | 40 | 4.6043 | 4.6418 |
0.82 | 41 | 4.7894 | 4.6375 |
0.84 | 42 | 4.6134 | 4.6341 |
0.86 | 43 | 4.6664 | 4.6307 |
0.88 | 44 | 4.5249 | 4.6264 |
0.9 | 45 | 4.7045 | 4.6227 |
0.92 | 46 | 4.7231 | 4.6198 |
0.94 | 47 | 4.7011 | 4.6176 |
0.96 | 48 | 4.5876 | 4.6159 |
0.98 | 49 | 4.7567 | 4.6146 |
1.0 | 50 | 4.6706 | 4.6138 |
Framework Versions
- Python: 3.10.12
- Sentence Transformers: 3.0.1
- Transformers: 4.41.2
- PyTorch: 2.3.0+cu121
- Accelerate: 0.31.0
- Datasets: 2.19.2
- Tokenizers: 0.19.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
- 4
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.
Model tree for edubm/vis-sim-triplets-mpnet
Base model
sentence-transformers/all-mpnet-base-v2