CoolFace
Modelpublic

kwondw/bert-base-uncased-trec-covid-tsdae

sourceHugging Faceupdated 23d agoView on Hugging Face
0likes26downloads
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 retrieval.

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
  • —Supported Modality: Text <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

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': 768, 'pooling_mode': 'cls', '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("kwondw/bert-base-uncased-trec-covid-tsdae")
# Run inference
sentences = [
    'Of, cyclization using CF (3 CO))) ·Et (2) show that the, and enamidones trifluoromethyl residue were.',
    'Of particular interest, the Friedel–Crafts cyclization using (CF(3)CO)(2)O/BF(3)·Et(2)O show that near the expected keto-lactams, enamides and enamidones containing trifluoromethyl residue were isolated.',
    'FINDINGS: Initial clinical presentation included fever, chills, and myalgia in both patients, and for patient 1, diarrhoea.',
]
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.7967, 0.4642],
#         [0.7967, 1.0000, 0.3914],
#         [0.4642, 0.3914, 1.0000]])

<!--

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

Information Retrieval
MetricValue
cosine_accuracy@10.3
cosine_accuracy@30.48
cosine_accuracy@50.62
cosine_accuracy@100.72
cosine_precision@10.3
cosine_precision@30.2467
cosine_precision@50.24
cosine_precision@100.202
cosine_recall@10.0008
cosine_recall@30.0018
cosine_recall@50.0029
cosine_recall@100.0049
cosine_ndcg@100.2191
cosine_mrr@100.4139
cosine_map@1000.0331

<!--

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: 1,204,106 training samples
  • —Columns: <code>noisy</code> and <code>text</code>
  • —Approximate statistics based on the first 1000 samples: | | noisy | text | |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 3 tokens</li><li>mean: 22.09 tokens</li><li>max: 75 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 34.99 tokens</li><li>max: 75 tokens</li></ul> |
  • —Samples: | noisy | text | |:-------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>of the mobile apps can potentially help mobile app developers improve or modify their mobile app achieve optimal outcomes</code> | <code>The results of the mobile apps assessment can potentially help mobile app developers improve or modify their existing mobile app designs to achieve optimal outcomes.</code> | | <code>In model such specialty of covid-19 virus as the presence of "super-spreaders" by a on a hierarchic landscape of social spreads infection</code> | <code>In particular, our model describes such a specialty of spread of covid-19 virus as the presence of "super-spreaders" who by performing a kind of random walk on a hierarchic landscape of social clusters spreads infection.</code> | | <code>The SARS-CoV-2 result</code> | <code>The primary outcome was SARS-CoV-2 test result.</code> |
  • —Loss: <code>DenoisingAutoEncoderLoss</code> with these parameters:
json
  {
      "decoder_name_or_path": "google-bert/bert-base-uncased",
      "need_retokenization": false
  }

Evaluation Dataset

Unnamed Dataset
  • —Size: 10,000 evaluation samples
  • —Columns: <code>noisy</code> and <code>text</code>
  • —Approximate statistics based on the first 1000 samples: | | noisy | text | |:--------|:---------------------------------------------------------------------------------|:----------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 3 tokens</li><li>mean: 21.7 tokens</li><li>max: 75 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 33.89 tokens</li><li>max: 75 tokens</li></ul> |
  • —Samples: | noisy | text | |:-----------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>The intraoperative hypertension and hypotension not the PHE non-PHE cohorts.</code> | <code>The frequency of intraoperative hypertension and hypotension did not differ between the PHE and non-PHE cohorts.</code> | | <code>, existing variants suffer problems: () large-scale optimization; (2) hyperparameter problem; high computational cost of the operations</code> | <code>However, the existing BSO variants can suffer from three problems: (1) large-scale optimization problem; (2) hyperparameter optimization problem; (3) high computational cost of the clustering operations.</code> | | <code>neurological impact of coronaviruses implications the novel SARS-CoV-2</code> | <code>Potential neurological impact of coronaviruses: implications for the novel SARS-CoV-2.</code> |
  • —Loss: <code>DenoisingAutoEncoderLoss</code> with these parameters:
json
  {
      "decoder_name_or_path": "google-bert/bert-base-uncased",
      "need_retokenization": false
  }

Training Hyperparameters

Non-Default Hyperparameters
  • —per_device_train_batch_size: 32
  • —per_device_eval_batch_size: 32
  • —learning_rate: 3e-05
  • —num_train_epochs: 1
  • —warmup_ratio: 0.1
  • —fp16: True
All Hyperparameters

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

  • —overwrite_output_dir: False
  • —do_predict: False
  • —prediction_loss_only: True
  • —per_device_train_batch_size: 32
  • —per_device_eval_batch_size: 32
  • —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: 1
  • —max_steps: -1
  • —lr_scheduler_type: linear
  • —lr_scheduler_kwargs: None
  • —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
  • —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: True
  • —dataloader_num_workers: 0
  • —dataloader_prefetch_factor: None
  • —past_index: -1
  • —disable_tqdm: False
  • —remove_unused_columns: True
  • —label_names: None
  • —load_best_model_at_end: False
  • —ignore_data_skip: False
  • —fsdp: []
  • —fsdp_min_num_params: 0
  • —fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • —fsdp_transformer_layer_cls_to_wrap: None
  • —accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}
  • —parallelism_config: None
  • —deepspeed: None
  • —label_smoothing_factor: 0.0
  • —optim: adamwtorchfused
  • —optim_args: None
  • —adafactor: False
  • —group_by_length: False
  • —length_column_name: length
  • —project: huggingface
  • —trackio_space_id: trackio
  • —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
  • —hub_revision: None
  • —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
  • —include_tokens_per_second: False
  • —include_num_input_tokens_seen: no
  • —neftune_noise_alpha: None
  • —optim_target_modules: None
  • —batch_eval_metrics: False
  • —eval_on_start: False
  • —use_liger_kernel: False
  • —liger_kernel_config: None
  • —eval_use_gather_object: False
  • —average_tokens_across_devices: True
  • —prompts: None
  • —batch_sampler: batch_sampler
  • —multi_dataset_batch_sampler: proportional
  • —router_mapping: {}
  • —learning_rate_mapping: {}

</details>

Training Logs

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

EpochStepTraining LossValidation Losstrec-covid_cosine_ndcg@10
-1-1--0.0426
0.00531008.8093--
0.01062007.0291--
0.01593006.0361--
0.02134005.3162--
0.02665004.948--
0.03196004.7147--
0.03727004.5298--
0.04258004.3886--
0.04789004.2642--
0.053210004.1818--
0.058511004.066--
0.063812004.0063--
0.069113003.9134--
0.074414003.84--
0.079715003.7689--
0.085016003.6951--
0.090417003.6394--
0.095718003.5781--
0.10001882-3.46840.3187
0.101019003.5428--
0.106320003.4823--
0.111621003.4376--
0.116922003.3825--
0.122223003.3455--
0.127624003.3159--
0.132925003.2707--
0.138226003.2369--
0.143527003.2121--
0.148828003.2047--
0.154129003.1562--
0.159530003.1153--
0.164831003.1192--
0.170132003.0879--
0.175433003.0675--
0.180734003.0677--
0.186035003.0446--
0.191336003.0262--
0.196737002.9887--
0.20013764-2.91820.2884
0.202038002.9773--
0.207339002.9757--
0.212640002.9605--
0.217941002.9488--
0.223242002.9405--
0.228643002.9177--
0.233944002.9198--
0.239245002.9111--
0.244546002.8871--
0.249847002.8818--
0.255148002.8733--
0.260449002.8406--
0.265850002.8417--
0.271151002.8224--
0.276452002.8358--
0.281753002.8043--
0.287054002.818--
0.292355002.7969--
0.297756002.7889--
0.30015646-2.71850.2657
0.303057002.7777--
0.308358002.7812--
0.313659002.7592--
0.318960002.7795--
0.324261002.7619--
0.329562002.7494--
0.334963002.7261--
0.340264002.7353--
0.345565002.7374--
0.350866002.7191--
0.356167002.695--
0.361468002.7202--
0.366769002.6993--
0.372170002.6927--
0.377471002.6739--
0.382772002.6903--
0.388073002.6657--
0.393374002.6901--
0.398675002.6457--
0.40017528-2.59670.2250
0.404076002.6521--
0.409377002.6469--
0.414678002.66--
0.419979002.6402--
0.425280002.641--
0.430581002.6278--
0.435882002.6179--
0.441283002.6184--
0.446584002.6266--
0.451885002.6196--
0.457186002.6184--
0.462487002.6039--
0.467788002.5929--
0.473189002.6021--
0.478490002.575--
0.483791002.5908--
0.489092002.5854--
0.494393002.5934--
0.499694002.5838--
0.50029410-2.50460.2278
0.504995002.5755--
0.510396002.5851--
0.515697002.5843--
0.520998002.5622--
0.526299002.5568--
0.5315100002.5473--
0.5368101002.5527--
0.5421102002.5696--
0.5475103002.529--
0.5528104002.5312--
0.5581105002.5354--
0.5634106002.5293--
0.5687107002.5307--
0.5740108002.5202--
0.5794109002.5353--
0.5847110002.5128--
0.5900111002.5097--
0.5953112002.4985--
0.600211292-2.44440.2278
0.6006113002.4931--
0.6059114002.5152--
0.6112115002.5082--
0.6166116002.5133--
0.6219117002.4898--
0.6272118002.4835--
0.6325119002.4962--
0.6378120002.4959--
0.6431121002.4912--
0.6485122002.4951--
0.6538123002.4988--
0.6591124002.4688--
0.6644125002.4879--
0.6697126002.446--
0.6750127002.4813--
0.6803128002.4651--
0.6857129002.4745--
0.6910130002.4683--
0.6963131002.4602--
0.700213174-2.39600.2213
0.7016132002.455--
0.7069133002.4537--
0.7122134002.4559--
0.7176135002.4847--
0.7229136002.4559--
0.7282137002.4427--
0.7335138002.4544--
0.7388139002.4579--
0.7441140002.4354--
0.7494141002.4515--
0.7548142002.4542--
0.7601143002.4387--
0.7654144002.4286--
0.7707145002.4113--
0.7760146002.4242--
0.7813147002.4239--
0.7866148002.4353--
0.7920149002.4352--
0.7973150002.4214--
0.800315056-2.35770.2162
0.8026151002.426--
0.8079152002.4113--
0.8132153002.4309--
0.8185154002.4175--
0.8239155002.4168--
0.8292156002.4352--
0.8345157002.4225--
0.8398158002.4063--
0.8451159002.4151--
0.8504160002.4027--
0.8557161002.3933--
0.8611162002.4156--
0.8664163002.4136--
0.8717164002.3916--
0.8770165002.4114--
0.8823166002.3812--
0.8876167002.411--
0.8930168002.4001--
0.8983169002.4018--
0.900316938-2.33110.2182
0.9036170002.395--
0.9089171002.4117--
0.9142172002.4186--
0.9195173002.3813--
0.9248174002.4138--
0.9302175002.3926--
0.9355176002.3758--
0.9408177002.3898--
0.9461178002.3859--
0.9514179002.3853--
0.9567180002.3903--
0.9620181002.3833--
0.9674182002.3949--
0.9727183002.3944--
0.9780184002.3831--
0.9833185002.3798--
0.9886186002.3609--
0.9939187002.3829--
0.9993188002.3793--
-1-1--0.2191

</details>

Training Time

  • —Training: 3.9 hours
  • —Evaluation: 33.6 minutes
  • —Total: 4.5 hours

Framework Versions

  • —Python: 3.12.13
  • —Sentence Transformers: 5.4.1
  • —Transformers: 4.57.6
  • —PyTorch: 2.10.0+cu128
  • —Accelerate: 1.13.0
  • —Datasets: 5.0.0
  • —Tokenizers: 0.22.2

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