MedCPT has been pre-trained by an unprecedented scale of 255M query-article pairs from PubMed search logs
, and has been shown to achieve state-of-the-art performance on several zero-shot biomedical IR datasets. In general, there are three use cases:
Query-to-article search with both encoders.
Query representation for clustering or query-to-query search with the
query encoder
.
Article representation for clustering or article-to-article search with the
article encoder
.
For more details, please check out our
paper
(Bioinformatics, 2023). Please note that the released version is slightly different from the version reported in the paper.
Case 1. Using the MedCPT Article Encoder
import torch
from transformers import AutoTokenizer, AutoModel
model = AutoModel.from_pretrained("ncbi/MedCPT-Article-Encoder")
tokenizer = AutoTokenizer.from_pretrained("ncbi/MedCPT-Article-Encoder")
# each article contains a list of two texts (usually a title and an abstract)
articles = [
[
"Diagnosis and Management of Central Diabetes Insipidus in Adults",
"Central diabetes insipidus (CDI) is a clinical syndrome which results from loss or impaired function of vasopressinergic neurons in the hypothalamus/posterior pituitary, resulting in impaired synthesis and/or secretion of arginine vasopressin (AVP). [...]",
],
[
"Adipsic diabetes insipidus",
"Adipsic diabetes insipidus (ADI) is a rare but devastating disorder of water balance with significant associated morbidity and mortality. Most patients develop the disease as a result of hypothalamic destruction from a variety of underlying etiologies. [...]",
],
[
"Nephrogenic diabetes insipidus: a comprehensive overview",
"Nephrogenic diabetes insipidus (NDI) is characterized by the inability to concentrate urine that results in polyuria and polydipsia, despite having normal or elevated plasma concentrations of arginine vasopressin (AVP). [...]",
],
]
with torch.no_grad():
# tokenize the articles
encoded = tokenizer(
articles,
truncation=True,
padding=True,
return_tensors='pt',
max_length=512,
)
# encode the queries (use the [CLS] last hidden states as the representations)
embeds = model(**encoded).last_hidden_state[:, 0, :]
print(embeds)
print(embeds.size())
This work was supported by the Intramural Research Programs of the National Institutes of Health, National Library of Medicine.
Disclaimer
This tool shows the results of research conducted in the Computational Biology Branch, NCBI/NLM. The information produced on this website is not intended for direct diagnostic use or medical decision-making without review and oversight by a clinical professional. Individuals should not change their health behavior solely on the basis of information produced on this website. NIH does not independently verify the validity or utility of the information produced by this tool. If you have questions about the information produced on this website, please see a health care professional. More information about NCBI's disclaimer policy is available.
Citation
If you find this repo helpful, please cite MedCPT by:
@article{jin2023medcpt,
title={MedCPT: Contrastive Pre-trained Transformers with large-scale PubMed search logs for zero-shot biomedical information retrieval},
author={Jin, Qiao and Kim, Won and Chen, Qingyu and Comeau, Donald C and Yeganova, Lana and Wilbur, W John and Lu, Zhiyong},
journal={Bioinformatics},
volume={39},
number={11},
pages={btad651},
year={2023},
publisher={Oxford University Press}
}
Runs of ncbi MedCPT-Article-Encoder on huggingface.co
66.9K
Total runs
-384
24-hour runs
100
3-day runs
3.8K
7-day runs
7.6K
30-day runs
More Information About MedCPT-Article-Encoder huggingface.co Model
MedCPT-Article-Encoder huggingface.co is an AI model on huggingface.co that provides MedCPT-Article-Encoder's model effect (), which can be used instantly with this ncbi MedCPT-Article-Encoder model. huggingface.co supports a free trial of the MedCPT-Article-Encoder model, and also provides paid use of the MedCPT-Article-Encoder. Support call MedCPT-Article-Encoder model through api, including Node.js, Python, http.
MedCPT-Article-Encoder huggingface.co is an online trial and call api platform, which integrates MedCPT-Article-Encoder's modeling effects, including api services, and provides a free online trial of MedCPT-Article-Encoder, you can try MedCPT-Article-Encoder online for free by clicking the link below.
ncbi MedCPT-Article-Encoder online free url in huggingface.co:
MedCPT-Article-Encoder is an open source model from GitHub that offers a free installation service, and any user can find MedCPT-Article-Encoder on GitHub to install. At the same time, huggingface.co provides the effect of MedCPT-Article-Encoder install, users can directly use MedCPT-Article-Encoder installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
MedCPT-Article-Encoder install url in huggingface.co: