CoolFace
Modelpublic

tartspuppy/bert-base-uncased-tsdae-encoder

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes33downloads
Model Card

SentenceTransformer based on google-bert/bert-base-uncased

This is a sentence-transformers model finetuned from google-bert/bert-base-uncased. 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: google-bert/bert-base-uncased <!-- at revision 86b5e0934494bd15c9632b12f734a8a67f723594 -->
  • Maximum Sequence Length: 75 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 75, 'do_lower_case': False}) with Transformer model: BertModel 
  (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})
)

Usage

Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

bash
pip install -U sentence-transformers

Then you can load this model and run inference.

python
from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("tartspuppy/bert-base-uncased-tsdae-encoder")
# Run inference
sentences = [
    'album five @ -, in an with Billboard magazine, said it was previously "something I wanted to revisit as been doing a while . "The medley a written whereas McCartney had worked the Beatles\' was made of "bits we had knocking . "The off with Vintage "McCartney sat one to looking back [and looking back . about life followed by the bass @ - @ led That Was Me, which is his school days and ",, "from there . songs "Feet the Clouds "about the inactivity while is up of ", about the life being a celebrity The final song medley, The End of ", written McCartney\'s unk> playing on his, Jim\'s piano',
    'The album features a five song @-@ medley , which in an interview with Billboard magazine , McCartney said that it was previously " something I wanted to revisit " as " nobody had been doing that for a while . " The medley was a group of intentionally written material , whereas McCartney had worked on the Beatles \' Abbey Road which , however , was actually made up of " bits we had knocking around . " The medley starts off with " Vintage Clothes " , which McCartney " sat down one day " to write , that was " looking back , [ and ] looking back . " , about life . It was followed by the bass @-@ led " That Was Me " , which is about his " school days and teachers " , the medley , as McCartney stated , then " progressed from there . " The next songs are " Feet in the Clouds " , about the inactivity while one is growing up , and " House of Wax " , about the life of being a celebrity . The final song in medley , " The End of the End " , was written at McCartney \'s <unk> Avenue home while playing on his father , Jim \'s , piano .',
    'Varanasi grew as an important industrial centre , famous for its muslin and silk <unk> , perfumes , ivory works , and sculpture . Buddha is believed to have founded Buddhism here around <unk> BC when he gave his first sermon , " The Setting in Motion of the Wheel of Dharma " , at nearby <unk> . The city \'s religious importance continued to grow in the 8th century , when Adi <unk> established the worship of Shiva as an official sect of Varanasi . Despite the Muslim rule , Varanasi remained the centre of activity for Hindu intellectuals and theologians during the Middle Ages , which further contributed to its reputation as a cultural centre of religion and education . <unk> Tulsidas wrote his epic poem on Lord Rama \'s life called Ram <unk> Manas in Varanasi . Several other major figures of the Bhakti movement were born in Varanasi , including Kabir and Ravidas . Guru Nanak Dev visited Varanasi for <unk> in <unk> , a trip that played a large role in the founding of <unk> . In the 16th century , Varanasi experienced a cultural revival under the Muslim Mughal emperor <unk> who invested in the city , and built two large temples dedicated to Shiva and Vishnu , though much of modern Varanasi was built during the 18th century , by the Maratha and <unk> kings . The kingdom of Benares was given official status by the <unk> in 1737 , and continued as a dynasty @-@ governed area until Indian independence in 1947 . The city is governed by the Varanasi Nagar Nigam ( Municipal Corporation ) and is represented in the Parliament of India by the current Prime Minister of India <unk> <unk> , who won the <unk> <unk> elections in 2014 by a huge margin . Silk weaving , carpets and crafts and tourism employ a significant number of the local population , as do the <unk> <unk> Works and Bharat Heavy <unk> Limited . Varanasi Hospital was established in 1964 .',
]
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]

<!--

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

Semantic Similarity
Metricsts-devsts-test
pearson_cosine0.65520.7355
spearman_cosine0.66410.732

<!--

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: 21,196 training samples
  • Columns: <code>text</code>
  • Approximate statistics based on the first 1000 samples: | | text | |:--------|:----------------------------------------------------------------------------------| | type | string | | details | <ul><li>min: 6 tokens</li><li>mean: 51.01 tokens</li><li>max: 75 tokens</li></ul> |
  • Samples: | text | |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>To promote the album , Carey announced a world tour in April 2003 . As of 2003 , " Charmbracelet World Tour : An Intimate Evening with Mariah Carey " was her most extensive tour , lasting over eight months and performing sixty @-@ nine shows in venues worldwide . Before tickets went on sale in the US , venues were switched from large arenas to smaller , more intimate theater shows . According to Carey , the change was made in order to give fans a more intimate show , and something more Broadway @-@ influenced . She said , " It 's much more intimate so you 'll feel like you had an experience . You experience a night with me . " However , while smaller productions were booked for the US leg of the tour , Carey performed at stadia and arenas in Asia and Europe , and performed for a crowd of over 35 @,@ 000 in Manila , 50 @,@ 000 in Malaysia , and to over 70 @,@ 000 people in China . In the UK , it was Carey 's first tour to feature shows outside London ; she performed in Glasgow , Birming...</code> | | <code>By 1916 , these raiding forces were causing serious concern in the Admiralty as the proximity of Bruges to the British coast , to the troopship lanes across the English Channel and for the U @-@ boats , to the Western Approaches ; the heaviest shipping lanes in the World at the time . In the late spring of 1915 , Admiral Reginald <unk> had attempted without success to destroy the lock gates at Ostend with monitors . This effort failed , and Bruges became increasingly important in the Atlantic Campaign , which reached its height in 1917 . By early 1918 , the Admiralty was seeking ever more radical solutions to the problems raised by unrestricted submarine warfare , including instructing the " Allied Naval and Marine Forces " department to plan attacks on U @-@ boat bases in Belgium .</code> | | <code>PWI International Heavyweight Championship ( 1 time )</code> |
  • Loss: <code>DenoisingAutoEncoderLoss</code>

Evaluation Dataset

Unnamed Dataset
  • Size: 2,355 evaluation samples
  • Columns: <code>text</code>
  • Approximate statistics based on the first 1000 samples: | | text | |:--------|:----------------------------------------------------------------------------------| | type | string | | details | <ul><li>min: 4 tokens</li><li>mean: 51.08 tokens</li><li>max: 75 tokens</li></ul> |
  • Samples: | text | |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>Wilde 's two final comedies , An Ideal Husband and The Importance of Being Earnest , were still on stage in London at the time of his prosecution , and they were soon closed as the details of his case became public . After two years in prison with hard labour , Wilde went into exile in Paris , sick and depressed , his reputation destroyed in England . In 1898 , when no @-@ one else would , Leonard Smithers agreed with Wilde to publish the two final plays . Wilde proved to be a <unk> <unk> , sending detailed instructions on stage directions , character listings and the presentation of the book , and insisting that a <unk> from the first performance be reproduced inside . Ellmann argues that the proofs show a man " very much in command of himself and of the play " . Wilde 's name did not appear on the cover , it was " By the Author of Lady Windermere 's Fan " . His return to work was brief though , as he refused to write anything else , " I can write , but have lost the joy of writing " ...</code> | | <code>= = = = Ely Viaduct = = = =</code> | | <code>= = World War I = =</code> |
  • Loss: <code>DenoisingAutoEncoderLoss</code>

Training Hyperparameters

Non-Default Hyperparameters
  • eval_strategy: steps
  • per_device_train_batch_size: 64
  • per_device_eval_batch_size: 64
  • learning_rate: 3e-05
  • num_train_epochs: 100
  • warmup_ratio: 0.1
  • fp16: True
  • dataloader_num_workers: 2
  • load_best_model_at_end: True
All Hyperparameters

<details><summary>Click to expand</summary>

  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • prediction_loss_only: True
  • per_device_train_batch_size: 64
  • per_device_eval_batch_size: 64
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 3e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1.0
  • num_train_epochs: 100
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.1
  • warmup_steps: 0
  • log_level: passive
  • log_level_replica: warning
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • save_safetensors: True
  • save_on_each_node: False
  • save_only_model: False
  • restore_callback_states_from_checkpoint: False
  • no_cuda: False
  • use_cpu: False
  • use_mps_device: False
  • seed: 42
  • data_seed: None
  • jit_mode_eval: False
  • use_ipex: False
  • bf16: False
  • fp16: True
  • fp16_opt_level: O1
  • half_precision_backend: auto
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • local_rank: 0
  • ddp_backend: None
  • tpu_num_cores: None
  • tpu_metrics_debug: False
  • debug: []
  • dataloader_drop_last: False
  • dataloader_num_workers: 2
  • dataloader_prefetch_factor: None
  • past_index: -1
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: True
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_min_num_params: 0
  • fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • tp_size: 0
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • skip_memory_metrics: True
  • use_legacy_prediction_loop: False
  • push_to_hub: False
  • resume_from_checkpoint: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_private_repo: None
  • hub_always_push: False
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • include_for_metrics: []
  • eval_do_concat_batches: True
  • fp16_backend: auto
  • push_to_hub_model_id: None
  • push_to_hub_organization: None
  • mp_parameters:
  • auto_find_batch_size: False
  • full_determinism: False
  • torchdynamo: None
  • ray_scope: last
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • dispatch_batches: None
  • split_batches: None
  • include_tokens_per_second: False
  • include_num_input_tokens_seen: False
  • neftune_noise_alpha: None
  • optim_target_modules: None
  • batch_eval_metrics: False
  • eval_on_start: False
  • use_liger_kernel: False
  • eval_use_gather_object: False
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: proportional

</details>

Training Logs

<details><summary>Click to expand</summary>

EpochStepTraining LossValidation Losssts-dev_spearman_cosinests-test_spearman_cosine
-1-1--0.3173-
0.60241008.2676---
1.20482006.0396---
1.80723004.7794---
2.40964004.2732---
3.01205003.9759---
3.61456003.7263---
4.21697003.5471---
4.81938003.4097---
5.42179003.2513---
6.024110003.16463.30520.7232-
6.626511003.0129---
7.228912002.9307---
7.831313002.8372---
8.433714002.7232---
9.036115002.6845---
9.638616002.546---
10.241017002.4931---
10.843418002.4064---
11.445819002.3145---
12.048220002.27153.14900.7177-
12.650621002.1495---
13.253022002.1164---
13.855423002.0398---
14.457824001.9538---
15.060225001.9311---
15.662726001.8264---
16.265127001.7786---
16.867528001.7256---
17.469929001.6395---
18.072330001.60823.46560.6894-
18.674731001.5152---
19.277132001.4678---
19.879533001.425---
20.481934001.3395---
21.084335001.3203---
21.686736001.2275---
22.289237001.1955---
22.891638001.1612---
23.494039001.0792---
24.096440001.05573.94730.6822-
24.698841000.9793---
25.301242000.9516---
25.903643000.9095---
26.506044000.8408---
27.108445000.8338---
27.710846000.7713---
28.313347000.8312---
28.915748000.8437---
29.518149000.6952---
30.120550000.68254.37020.6671-
30.722951001.7624---
31.325352006.9439---
31.927753006.2218---
32.530154005.9866---
33.132555005.8608---
33.734956005.7661---
34.337357005.7114---
34.939858005.6526---
35.542259005.5982---
36.144660005.56325.66960.7876-
36.747061005.5455---
37.349462005.4853---
37.951863005.4709---
38.554264005.4372---
39.156665005.405---
39.759066005.4011---
40.361467005.3779---
40.963968005.3684---
41.566369005.3462---
42.168770005.3355.50900.7515-
42.771171005.3273---
43.373572005.3078---
43.975973005.3005---
44.578374005.2836---
45.180775005.2732---
45.783176005.2707---
46.385577005.2525---
46.988078005.2439---
47.590479005.2316---
48.192880005.21215.44510.7316-
48.795281005.2142---
49.397682005.1939---
50.083005.186---
50.602484005.166---
51.204885005.1727---
51.807286005.1555---
52.409687005.1538---
53.012088005.1413---
53.614589005.1343---
54.216990005.12575.39390.7142-
54.819391005.1183---
55.421792005.116---
56.024193005.0999---
56.626594005.0922---
57.228995005.0756---
57.831396005.0792---
58.433797005.061---
59.036198005.0663---
59.638699005.0493---
60.2410100005.04875.36130.7019-
60.8434101005.0462---
61.4458102005.0356---
62.0482103005.0379---
62.6506104005.0243---
63.2530105005.0091---
63.8554106005.0128---
64.4578107005.0099---
65.0602108005.0078---
65.6627109004.9965---
66.2651110004.99075.33100.6963-
66.8675111004.9918---
67.4699112004.9724---
68.0723113004.984---
68.6747114004.9689---
69.2771115004.9636---
69.8795116004.9622---
70.4819117004.9547---
71.0843118004.9527---
71.6867119004.9467---
72.2892120004.93975.31860.6832-
72.8916121004.9387---
73.4940122004.9299---
74.0964123004.9454---
74.6988124004.9267---
75.3012125004.9258---
75.9036126004.9244---
76.5060127004.9214---
77.1084128004.9125---
77.7108129004.9122---
78.3133130004.91085.30260.6840-
78.9157131004.9073---
79.5181132004.8944---
80.1205133004.8987---
80.7229134004.9013---
81.3253135004.8915---
81.9277136004.8883---
82.5301137004.8861---
83.1325138004.882---
83.7349139004.8812---
84.3373140004.88055.29680.6695-
84.9398141004.8839---
85.5422142004.8747---
86.1446143004.8652---
86.7470144004.8734---
87.3494145004.872---
87.9518146004.8621---
88.5542147004.8599---
89.1566148004.8649---
89.7590149004.8621---
90.3614150004.84835.28600.6694-
90.9639151004.8538---
91.5663152004.86---
92.1687153004.8463---
92.7711154004.8582---
93.3735155004.8444---
93.9759156004.8482---
94.5783157004.848---
95.1807158004.8489---
95.7831159004.8403---
96.3855160004.84255.28280.6641-
96.9880161004.8423---
97.5904162004.8377---
98.1928163004.8448---
98.7952164004.8384---
99.3976165004.8381---
100.0166004.8389---
-1-1---0.7320
  • The bold row denotes the saved checkpoint. </details>

Framework Versions

  • Python: 3.12.9
  • Sentence Transformers: 4.0.1
  • Transformers: 4.50.1
  • PyTorch: 2.6.0+cu124
  • Accelerate: 1.5.2
  • Datasets: 3.4.1
  • Tokenizers: 0.21.1

Citation

BibTeX

Sentence Transformers
bibtex
@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",
}
DenoisingAutoEncoderLoss
bibtex
@inproceedings{wang-2021-TSDAE,
    title = "TSDAE: Using Transformer-based Sequential Denoising Auto-Encoderfor Unsupervised Sentence Embedding Learning",
    author = "Wang, Kexin and Reimers, Nils and Gurevych, Iryna",
    booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2021",
    month = nov,
    year = "2021",
    address = "Punta Cana, Dominican Republic",
    publisher = "Association for Computational Linguistics",
    pages = "671--688",
    url = "https://arxiv.org/abs/2104.06979",
}

<!--

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. -->