Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 16
How to use rishhh/verisci-scifact-e5-retriever with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("rishhh/verisci-scifact-e5-retriever")
sentences = [
"query: Bcp1 is a chaperone for Rpl23.",
"passage: Effects of exercise training on health status in patients with chronic heart failure: HF-ACTION randomized controlled trial. CONTEXT Findings from previous studies of the effects of exercise training on patient-reported health status have been inconsistent. \n OBJECTIVE To test the effects of exercise training on health status among patients with heart failure. \n DESIGN, SETTING, AND PATIENTS Multicenter, randomized controlled trial among 2331 medically stable outpatients with heart failure with left ventricular ejection fraction of 35% or less. Patients were randomized from April 2003 through February 2007. \n INTERVENTIONS Usual care plus aerobic exercise training (n = 1172), consisting of 36 supervised sessions followed by home-based training, vs usual care alone (n = 1159). Randomization was stratified by heart failure etiology, which was a covariate in all models. \n MAIN OUTCOME MEASURES Kansas City Cardiomyopathy Questionnaire (KCCQ) overall summary scale and key subscales at baseline, every 3 months for 12 months, and annually thereafter for up to 4 years. The KCCQ is scored from 0 to 100 with higher scores corresponding to better health status. Treatment group effects were estimated using linear mixed models according to the intention-to-treat principle. \n RESULTS Median follow-up was 2.5 years. At 3 months, usual care plus exercise training led to greater improvement in the KCCQ overall summary score (mean, 5.21; 95% confidence interval, 4.42 to 6.00) compared with usual care alone (3.28; 95% confidence interval, 2.48 to 4.09). The additional 1.93-point increase (95% confidence interval, 0.84 to 3.01) in the exercise training group was statistically significant (P < .001). After 3 months, there were no further significant changes in KCCQ score for either group (P = .85 for the difference between slopes), resulting in a sustained, greater improvement overall for the exercise group (P < .001). Results were similar on the KCCQ subscales, and no subgroup interactions were detected. \n CONCLUSIONS Exercise training conferred modest but statistically significant improvements in self-reported health status compared with usual care without training. Improvements occurred early and persisted over time. \n TRIAL REGISTRATION clinicaltrials.gov Identifier: NCT00047437.",
"passage: Rational Extension of the Ribosome Biogenesis Pathway Using Network-Guided Genetics Biogenesis of ribosomes is an essential cellular process conserved across all eukaryotes and is known to require >170 genes for the assembly, modification, and trafficking of ribosome components through multiple cellular compartments. Despite intensive study, this pathway likely involves many additional genes. Here, we employ network-guided genetics-an approach for associating candidate genes with biological processes that capitalizes on recent advances in functional genomic and proteomic studies-to computationally identify additional ribosomal biogenesis genes. We experimentally evaluated >100 candidate yeast genes in a battery of assays, confirming involvement of at least 15 new genes, including previously uncharacterized genes (YDL063C, YIL091C, YOR287C, YOR006C/TSR3, YOL022C/TSR4). We associate the new genes with specific aspects of ribosomal subunit maturation, ribosomal particle association, and ribosomal subunit nuclear export, and we identify genes specifically required for the processing of 5S, 7S, 20S, 27S, and 35S rRNAs. These results reveal new connections between ribosome biogenesis and mRNA splicing and add >10% new genes-most with human orthologs-to the biogenesis pathway, significantly extending our understanding of a universally conserved eukaryotic process.",
"passage: ABC of burns. Introduction. Burns are one of the most devastating conditions encountered in medicine. The injury represents an assault on all aspects of the patient, from the physical to the psychological. It affects all ages, from babies to elderly people, and is a problem in both the developed and developing world. All of us have experienced the severe pain that even a small burn can bring. However the pain and distress caused by a large burn are not limited to the immediate event. The visible physical and the invisible psychological scars are long lasting and often lead to chronic disability. Burn injuries represent a diverse and varied challenge to medical and paramedical staff. Correct management requires a skilled multidisciplinary approach that addresses all the problems facing a burn patient. This series provides an overview of the most important aspects of burn injuries for hospital and non-hospital healthcare workers.workers. Figure 1 Top: Child with 70% full thickness burns, which required resuscitation, intensive care support, and extensive debridement and skin grafting. Left: The same child one year later at a burns camp, having made a good recovery. A reasonable outcome is possible ..."
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]This is a sentence-transformers model finetuned from intfloat/e5-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.
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel
(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()
)
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("sentence_transformers_model_id")
# Run inference
sentences = [
'query: Upregulation of dynein in Drosophila neurons increases the number of microtubule plus-ends growing toward the cell body of each neuron.',
'passage: Dynein is required for polarized dendritic transport and uniform microtubule orientation in axons Axons and dendrites differ in both microtubule organization and in the organelles and proteins they contain. Here we show that the microtubule motor dynein has a crucial role in polarized transport and in controlling the orientation of axonal microtubules in Drosophila melanogaster dendritic arborization (da) neurons. Changes in organelle distribution within the dendritic arbors of dynein mutant neurons correlate with a proximal shift in dendritic branch position. Dynein is also necessary for the dendrite-specific localization of Golgi outposts and the ion channel Pickpocket. Axonal microtubules are normally oriented uniformly plus-end-distal; however, without dynein, axons contain both plus- and minus-end distal microtubules. These data suggest that dynein is required for the distinguishing properties of the axon and dendrites: without dynein, dendritic organelles and proteins enter the axon and the axonal microtubules are no longer uniform in polarity.',
'passage: Tyr26 phosphorylation of PGAM1 provides a metabolic advantage to tumours by stabilizing the active conformation How oncogenic signalling coordinates glycolysis and anabolic biosynthesis in cancer cells remains unclear. We recently reported that the glycolytic enzyme phosphoglycerate mutase 1 (PGAM1) regulates anabolic biosynthesis by controlling intracellular levels of its substrate 3-phosphoglycerate and product 2-phosphoglycerate. Here we report a novel mechanism in which Y26 phosphorylation enhances PGAM1 activation through release of inhibitory E19 that blocks the active site, stabilising cofactor 2,3-bisphosphoglycerate binding and H11 phosphorylation. We also report the crystal structure of H11-phosphorylated PGAM1 and find that phospho-H11 activates PGAM1 at least in part by promoting substrate 3-phosphoglycerate binding. Moreover, Y26 phosphorylation of PGAM1 is common in human cancer cells and contributes to regulation of 3-phosphoglycerate and 2-phosphoglycerate levels, promoting cancer cell proliferation and tumour growth. As PGAM1 is a negative transcriptional target of TP53, and is therefore commonly upregulated in human cancers, these findings suggest that Y26 phosphorylation represents an additional acute mechanism underlying phosphoglycerate mutase 1 upregulation.',
]
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]
sentence_0 and sentence_1| sentence_0 | sentence_1 | |
|---|---|---|
| type | string | string |
| details |
|
|
| sentence_0 | sentence_1 |
|---|---|
query: Cancer-associated fibroblasts (CAFs) have no known interaction with cancer cells in the formation and activation of CAFs. |
passage: Microenvironmental regulation of tumor progression and metastasis Cancers develop in complex tissue environments, which they depend on for sustained growth, invasion and metastasis. Unlike tumor cells, stromal cell types within the tumor microenvironment (TME) are genetically stable and thus represent an attractive therapeutic target with reduced risk of resistance and tumor recurrence. However, specifically disrupting the pro-tumorigenic TME is a challenging undertaking, as the TME has diverse capacities to induce both beneficial and adverse consequences for tumorigenesis. Furthermore, many studies have shown that the microenvironment is capable of normalizing tumor cells, suggesting that re-education of stromal cells, rather than targeted ablation per se, may be an effective strategy for treating cancer. Here we discuss the paradoxical roles of the TME during specific stages of cancer progression and metastasis, as well as recent therapeutic attempts to re-educate stromal ce... |
query: Eilat virus (EILV) produced in mosquitos elicits rapid and long-lasting neutralizing antibodies in nonhuman primates. |
passage: A chikungunya fever vaccine utilizing an insect-specific virus platform Traditionally, vaccine development involves tradeoffs between immunogenicity and safety. Live-attenuated vaccines typically offer rapid and durable immunity but have reduced safety when compared to inactivated vaccines. In contrast, the inability of inactivated vaccines to replicate enhances safety at the expense of immunogenicity, often necessitating multiple doses and boosters. To overcome these tradeoffs, we developed the insect-specific alphavirus, Eilat virus (EILV), as a vaccine platform. To address the chikungunya fever (CHIKF) pandemic, we used an EILV cDNA clone to design a chimeric virus containing the chikungunya virus (CHIKV) structural proteins. The recombinant EILV/CHIKV was structurally identical at 10 Å to wild-type CHIKV, as determined by single-particle cryo-electron microscopy, and it mimicked the early stages of CHIKV replication in vertebrate cells from attachment and entry to viral RN... |
query: Glial calcium waves influence seizures. |
passage: An Excitatory Loop with Astrocytes Contributes to Drive Neurons to Seizure Threshold Seizures in focal epilepsies are sustained by a highly synchronous neuronal discharge that arises at restricted brain sites and subsequently spreads to large portions of the brain. Despite intense experimental research in this field, the earlier cellular events that initiate and sustain a focal seizure are still not well defined. Their identification is central to understand the pathophysiology of focal epilepsies and to develop new pharmacological therapies for drug-resistant forms of epilepsy. The prominent involvement of astrocytes in ictogenesis was recently proposed. We test here whether a cooperation between astrocytes and neurons is a prerequisite to support ictal (seizure-like) and interictal epileptiform events. Simultaneous patch-clamp recording and Ca2+ imaging techniques were performed in a new in vitro model of focal seizures induced by local applications of N-methyl-D-aspartic ac... |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
per_device_train_batch_size: 32per_device_eval_batch_size: 32multi_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 32per_device_eval_batch_size: 32per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1num_train_epochs: 3max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_ratio: 0.0warmup_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: Falsebf16: Falsefp16: Falsefp16_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}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_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: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_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: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: noneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Trueprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robin@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",
}
@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}
}
Base model
intfloat/e5-base-v2