tomaarsen/stsb-distilbert-base-quora-duplicate-questions
SentenceTransformer based on sentence-transformers/stsb-distilbert-base
This is a sentence-transformers model finetuned from sentence-transformers/stsb-distilbert-base. 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/stsb-distilbert-base
- Maximum Sequence Length: 128 tokens
- Output Dimensionality: 768 tokens <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->
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': 128, 'do_lower_case': False}) with Transformer model: DistilBertModel
(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})
)Usage
Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
pip install -U sentence-transformersThen you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("tomaarsen/stsb-distilbert-base-quora-duplicate-questions")
# Run inference
sentences = [
"What is a fetish?",
"What's a fetish?",
"Is it good to read sex stories?",
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]<!--
Direct Usage (Transformers)
<details><summary>Click to see the direct usage in Transformers</summary>
</details> -->
<!--
Downstream Usage (Sentence Transformers)
You can finetune this model on your own dataset.
<details><summary>Click to expand</summary>
</details> -->
<!--
Out-of-Scope Use
List how the model may foreseeably be misused and address what users ought not to do with the model. -->
Evaluation
Metrics
Binary Classification
- Evaluated with <code>BinaryClassificationEvaluator</code>
Paraphrase Mining
- Dataset:
dev - Evaluated with <code>ParaphraseMiningEvaluator</code>
Information Retrieval
- Evaluated with <code>InformationRetrievalEvaluator</code>
<!--
Bias, Risks and Limitations
What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model. -->
<!--
Recommendations
What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->
Training Details
Training Dataset
Unnamed Dataset
- Size: 207,326 training samples
- Columns: <code>sentence0</code>, <code>sentence1</code>, and <code>label</code>
- Approximate statistics based on the first 1000 samples: | | sentence0 | sentence1 | label | |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:------------------------------| | type | string | string | int | | details | <ul><li>min: 6 tokens</li><li>mean: 13.75 tokens</li><li>max: 42 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 13.74 tokens</li><li>max: 44 tokens</li></ul> | <ul><li>1: ~100.00%</li></ul> |
- Samples: | sentence0 | sentence1 | label | |:------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------|:---------------| | <code>How do I improve writing skill by myself?</code> | <code>How can I improve writing skills?</code> | <code>1</code> | | <code>Is it best to switch to Node.js from PHP?</code> | <code>Should I switch to Node.js or continue using PHP?</code> | <code>1</code> | | <code>What do Hillary Clinton's supporters say when confronted with all her lies and scandals?</code> | <code>What do Clinton supporters say when confronted with her scandals such as the emails and 'Clinton Cash'?</code> | <code>1</code> |
- Loss: <code>sentence_transformers.losses.MultipleNegativesRankingLoss.MultipleNegativesRankingLoss</code> with these parameters:
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}Training Hyperparameters
Non-Default Hyperparameters
- perdevicetrainbatchsize: 64
- perdeviceevalbatchsize: 64
- numtrainepochs: 1
- roundrobinsampler: True
All Hyperparameters
<details><summary>Click to expand</summary>
- overwriteoutputdir: False
- do_predict: False
- predictionlossonly: False
- perdevicetrainbatchsize: 64
- perdeviceevalbatchsize: 64
- pergputrainbatchsize: None
- pergpuevalbatchsize: None
- gradientaccumulationsteps: 1
- evalaccumulationsteps: None
- learning_rate: 5e-05
- weight_decay: 0.0
- adam_beta1: 0.9
- adam_beta2: 0.999
- adam_epsilon: 1e-08
- maxgradnorm: 1
- numtrainepochs: 1
- max_steps: -1
- lrschedulertype: linear
- lrschedulerkwargs: {}
- warmup_ratio: 0.0
- warmup_steps: 0
- log_level: passive
- loglevelreplica: warning
- logoneach_node: True
- loggingnaninf_filter: True
- save_safetensors: True
- saveoneach_node: False
- saveonlymodel: False
- no_cuda: False
- use_cpu: False
- usempsdevice: False
- seed: 42
- data_seed: None
- jitmodeeval: False
- use_ipex: False
- bf16: False
- fp16: False
- fp16optlevel: O1
- halfprecisionbackend: auto
- bf16fulleval: False
- fp16fulleval: False
- tf32: None
- local_rank: 0
- ddp_backend: None
- tpunumcores: None
- tpumetricsdebug: False
- debug: []
- dataloaderdroplast: False
- dataloadernumworkers: 0
- dataloaderprefetchfactor: None
- past_index: -1
- disable_tqdm: False
- removeunusedcolumns: True
- label_names: None
- loadbestmodelatend: False
- ignoredataskip: False
- fsdp: []
- fsdpminnum_params: 0
- fsdpconfig: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgradckpt': False}
- fsdptransformerlayerclsto_wrap: None
- acceleratorconfig: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True}
- deepspeed: None
- labelsmoothingfactor: 0.0
- optim: adamw_torch
- optim_args: None
- adafactor: False
- groupbylength: False
- lengthcolumnname: length
- ddpfindunused_parameters: None
- ddpbucketcap_mb: None
- ddpbroadcastbuffers: None
- dataloaderpinmemory: True
- dataloaderpersistentworkers: False
- skipmemorymetrics: True
- uselegacyprediction_loop: False
- pushtohub: False
- resumefromcheckpoint: None
- hubmodelid: None
- hubstrategy: everysave
- hubprivaterepo: False
- hubalwayspush: False
- gradient_checkpointing: False
- gradientcheckpointingkwargs: None
- includeinputsfor_metrics: False
- fp16_backend: auto
- pushtohubmodelid: None
- pushtohub_organization: None
- mp_parameters:
- autofindbatch_size: False
- full_determinism: False
- torchdynamo: None
- ray_scope: last
- ddp_timeout: 1800
- torch_compile: False
- torchcompilebackend: None
- torchcompilemode: None
- dispatch_batches: None
- split_batches: None
- includetokensper_second: False
- includenuminputtokensseen: False
- neftunenoisealpha: None
- optimtargetmodules: None
- roundrobinsampler: True
</details>
Training Logs
Framework Versions
- Python: 3.11.6
- Sentence Transformers: 2.7.0.dev0
- Transformers: 4.39.3
- PyTorch: 2.1.0+cu121
- Accelerate: 0.26.1
- Datasets: 2.18.0
- Tokenizers: 0.15.2
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",
}MultipleNegativesRankingLoss
@misc{henderson2017efficient,
title={Efficient Natural Language Response Suggestion for Smart Reply},
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},
year={2017},
eprint={1705.00652},
archivePrefix={arXiv},
primaryClass={cs.CL}
}<!--
Glossary
Clearly define terms in order to be accessible across audiences. -->
<!--
Model Card Authors
Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction. -->
<!--
Model Card Contact
Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors. -->
