CoolFace
Modelpublic

wwydmanski/bge-m3-retromae-pubmed-v0.1

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes22downloads
Model Card

SentenceTransformer based on BAAI/bge-m3-retromae

This is a sentence-transformers model finetuned from BAAI/bge-m3-retromae on the json dataset. It maps sentences & paragraphs to a 1024-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: BAAI/bge-m3-retromae <!-- at revision 95c4f81ef8f7911dcac8e384532489c32c8dea64 -->
  • —Maximum Sequence Length: 8192 tokens
  • —Output Dimensionality: 1024 dimensions
  • —Similarity Function: Cosine Similarity
  • —Training Dataset:
  • —json <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: PeftModelForFeatureExtraction 
  (1): Pooling({'word_embedding_dimension': 1024, '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:

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("sentence_transformers_model_id")
# Run inference
sentences = [
    'Calcineurin inhibitor-sparing regimen',
    'Belatacept-based immunosuppression: A calcineurin inhibitor-sparing regimen in heart transplant recipients. ',
    'Neurotoxicity of calcineurin inhibitors: impact and clinical management. ',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]

# 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

Triplet
MetricValue
cosine_accuracy0.723

<!--

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

json
  • —Dataset: json
  • —Size: 15,182 training samples
  • —Columns: <code>anchor</code>, <code>positive</code>, and <code>negative</code>
  • —Approximate statistics based on the first 1000 samples: | | anchor | positive | negative | |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 4 tokens</li><li>mean: 10.68 tokens</li><li>max: 49 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 26.34 tokens</li><li>max: 79 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 15.75 tokens</li><li>max: 66 tokens</li></ul> |
  • —Samples: | anchor | positive | negative | |:--------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------| | <code>Immunogenetic polymorphism</code> | <code>Immunogenetic polymorphism and disease mechanisms in juvenile chronic arthritis. </code> | <code>Immunogenetic model. </code> | | <code>Alemtuzumab-induced pancolitis</code> | <code>Pancolitis a novel early complication of Alemtuzumab for MS treatment. </code> | <code>Alemtuzumab in lymphoproliferate disorders. </code> | | <code>Intermittent infectiousness</code> | <code>Understanding the effects of intermittent shedding on the transmission of infectious diseases: example of salmonellosis in pigs. </code> | <code>Infectious behaviour. </code> |
  • —Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }

Training Hyperparameters

Non-Default Hyperparameters
  • —eval_strategy: steps
  • —per_device_train_batch_size: 32
  • —per_device_eval_batch_size: 32
  • —num_train_epochs: 1
  • —lr_scheduler_type: cosinewithrestarts
  • —warmup_ratio: 0.1
  • —bf16: True
  • —batch_sampler: no_duplicates
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: 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: 5e-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: cosinewithrestarts
  • —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: True
  • —fp16: False
  • —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: 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}
  • —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: False
  • —hub_always_push: False
  • —gradient_checkpointing: False
  • —gradient_checkpointing_kwargs: None
  • —include_inputs_for_metrics: False
  • —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
  • —eval_use_gather_object: False
  • —prompts: None
  • —batch_sampler: no_duplicates
  • —multi_dataset_batch_sampler: proportional

</details>

Training Logs

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

EpochStepTraining Losstriplet-dev_cosine_accuracy
00-0.543
0.003213.4406-
0.006423.2403-
0.009633.3734-
0.012843.3858-
0.016053.3195-
0.019263.2708-
0.022473.4507-
0.025683.4782-
0.028893.2926-
0.0319103.2744-
0.0351113.4455-
0.0383123.3225-
0.0415133.3568-
0.0447143.3349-
0.0479153.2672-
0.0511163.2584-
0.0543173.1607-
0.0575183.1793-
0.0607193.1924-
0.0639203.2913-
0.0671213.2028-
0.0703223.1448-
0.0735233.0991-
0.0767243.1371-
0.0799253.0089-
0.0831263.1232-
0.0863272.8794-
0.0895282.982-
0.0927293.231-
0.0958302.9288-
0.0990313.0117-
0.1022322.8717-
0.1054332.7002-
0.1086342.6395-
0.1118352.5087-
0.1150362.7469-
0.1182372.6306-
0.1214382.1149-
0.1246392.5591-
0.1278402.0133-
0.1310412.2863-
0.1342422.2592-
0.1374432.1261-
0.1406442.278-
0.1438451.7339-
0.1470461.8337-
0.1502471.5944-
0.1534482.0899-
0.1565491.509-
0.1597501.8651-
0.1629512.2858-
0.1661522.6881-
0.1693531.7877-
0.1725541.6374-
0.1757552.0763-
0.1789561.7672-
0.1821571.7913-
0.1853581.8524-
0.1885592.2614-
0.1917601.8058-
0.1949612.0403-
0.1981621.2697-
0.2013631.9523-
0.2045641.3965-
0.2077651.5501-
0.2109661.0785-
0.2141671.721-
0.2173681.9049-
0.2204691.4317-
0.2236701.905-
0.2268711.236-
0.2300721.7312-
0.2332730.9951-
0.2364741.5471-
0.2396751.1289-
0.2428761.7902-
0.2460771.2619-
0.2492781.0043-
0.2524791.7546-
0.2556801.8505-
0.2588811.7437-
0.2620821.2788-
0.2652831.438-
0.2684841.5399-
0.2716852.1841-
0.2748861.6834-
0.2780871.3842-
0.2812881.619-
0.2843891.2492-
0.2875901.3613-
0.2907911.2457-
0.2939921.2966-
0.2971931.3718-
0.3003941.3675-
0.3035952.1095-
0.3067961.6177-
0.3099971.3287-
0.3131981.9805-
0.3163991.3861-
0.31951001.83920.622
0.32271011.4698-
0.32591021.4499-
0.32911031.5338-
0.33231041.3867-
0.33551051.7414-
0.33871061.5203-
0.34191071.6059-
0.34501081.3799-
0.34821091.5004-
0.35141101.0175-
0.35461111.0399-
0.35781121.6369-
0.36101131.5692-
0.36421141.6808-
0.36741151.4315-
0.37061160.9854-
0.37381171.3637-
0.37701181.3986-
0.38021191.3848-
0.38341201.4436-
0.38661211.0704-
0.38981221.3788-
0.39301231.7131-
0.39621241.5013-
0.39941251.7377-
0.40261262.0296-
0.40581271.2643-
0.40891281.3647-
0.41211291.175-
0.41531301.0797-
0.41851311.5746-
0.42171321.0914-
0.42491331.6672-
0.42811341.2959-
0.43131351.5387-
0.43451361.2571-
0.43771371.42-
0.44091381.3452-
0.44411391.2238-
0.44731400.9963-
0.45051411.0326-
0.45371420.8793-
0.45691431.2197-
0.46011441.2992-
0.46331451.1456-
0.46651461.6002-
0.46961471.54-
0.47281481.2323-
0.47601491.0184-
0.47921501.2416-
0.48241511.1777-
0.48561521.0964-
0.48881531.0828-
0.49201541.3446-
0.49521550.9454-
0.49841560.7719-
0.50161571.003-
0.50481580.9863-
0.50801590.9672-
0.51121601.1432-
0.51441611.0377-
0.51761621.102-
0.52081630.9345-
0.52401640.9486-
0.52721651.5389-
0.53041661.8956-
0.53351671.0425-
0.53671681.5296-
0.53991690.9602-
0.54311700.9832-
0.54631711.0982-
0.54951721.6295-
0.55271731.3986-
0.55591741.1721-
0.55911750.7994-
0.56231761.5655-
0.56551771.2068-
0.56871781.2747-
0.57191791.0729-
0.57511800.9977-
0.57831811.3537-
0.58151821.0964-
0.58471830.8029-
0.58791840.765-
0.59111851.0457-
0.59421861.2928-
0.59741871.2354-
0.60061881.031-
0.60381891.2561-
0.60701901.1676-
0.61021911.2186-
0.61341921.1786-
0.61661931.283-
0.61981940.8316-
0.62301951.2239-
0.62621961.08-
0.62941971.7637-
0.63261981.2315-
0.63581991.5375-
0.63902001.43880.73
0.64222011.3918-
0.64542021.37-
0.64862031.3753-
0.65182041.137-
0.65502051.4457-
0.65812061.3072-
0.66132072.0953-
0.66452081.6811-
0.66772090.9206-
0.67092100.9801-
0.67412110.961-
0.67732121.386-
0.68052131.5354-
0.68372140.6571-
0.68692151.2631-
0.69012161.2122-
0.69332171.6253-
0.69652181.266-
0.69972191.7445-
0.70292201.1527-
0.70612211.7681-
0.70932221.4941-
0.71252231.8236-
0.71572241.4117-
0.71882250.7363-
0.72202261.4519-
0.72522271.4138-
0.72842281.0758-
0.73162291.6275-
0.73482301.6303-
0.73802311.4706-
0.74122320.5958-
0.74442331.2442-
0.74762341.3782-
0.75082351.3971-
0.75402361.3412-
0.75722370.9017-
0.76042381.6336-
0.76362391.2652-
0.76682401.0598-
0.77002411.3082-
0.77322420.9677-
0.77642431.2684-
0.77962441.3539-
0.78272451.7301-
0.78592461.2539-
0.78912471.1073-
0.79232481.079-
0.79552491.3488-
0.79872501.0672-
0.80192511.4308-
0.80512521.126-
0.80832531.131-
0.81152540.9585-
0.81472550.9348-
0.81792561.1288-
0.82112571.2577-
0.82432581.286-
0.82752591.1985-
0.83072601.2386-
0.83392611.6239-
0.83712620.8122-
0.84032631.42-
0.84352640.9854-
0.84662650.9861-
0.84982661.2226-
0.85302671.1535-
0.85622681.634-
0.85942691.0699-
0.86262701.2927-
0.86582711.2269-
0.86902720.8528-
0.87222731.6345-
0.87542741.4596-
0.87862750.9795-
0.88182761.1772-
0.88502771.135-
0.88822780.994-
0.89142790.8705-
0.89462800.976-
0.89782811.2215-
0.90102821.4685-
0.90422831.6724-
0.90732841.3882-
0.91052851.2283-
0.91372861.0334-
0.91692871.2039-
0.92012881.0914-
0.92332891.7033-
0.92652901.7687-
0.92972911.2867-
0.93292921.196-
0.93612930.9771-
0.93932941.1878-
0.94252951.235-
0.94572961.4398-
0.94892971.475-
0.95212981.2632-
0.95532991.5732-
0.95853001.01470.725
0.96173011.0345-
0.96493021.2582-
0.96813031.0398-
0.97123041.3973-
0.97443051.6701-
0.97763061.2617-
0.98083071.5779-
0.98403081.0839-
0.98723091.3117-
0.99043101.6139-
0.99363111.0128-
0.99683120.837-
1.03131.36870.723

</details>

Framework Versions

  • —Python: 3.12.3
  • —Sentence Transformers: 3.3.1
  • —Transformers: 4.44.2
  • —PyTorch: 2.5.1
  • —Accelerate: 1.2.1
  • —Datasets: 2.19.0
  • —Tokenizers: 0.19.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",
}
MultipleNegativesRankingLoss
bibtex
@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. -->