AI SeedbankHelp preserve open and free AI for humanity's future

← All models

cambridgeltl_SapBERT-from-PubMedBERT-fulltext

cambridgeltl · View on Hugging Face ↗

Get this model

Download TorrentMagnet Link

Seeders: · Leechers:

Model card

The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.


license: apache-2.0 language:

  • en tags:
  • biomedical
  • lexical semantics
  • bionlp
  • biology
  • science
  • embedding
  • entity linking


datasets:

  • UMLS

[news] A cross-lingual extension of SapBERT will appear in the main onference of ACL 2021!
[news] SapBERT will appear in the conference proceedings of NAACL 2021!

SapBERT-PubMedBERT

SapBERT by Liu et al. (2020). Trained with UMLS 2020AA (English only), using microsoft/BiomedNLP-PubMedBERT-base-uncased-abstract-fulltext as the base model.

Expected input and output

The input should be a string of biomedical entity names, e.g., "covid infection" or "Hydroxychloroquine". The [CLS] embedding of the last layer is regarded as the output.

Extracting embeddings from SapBERT

The following script converts a list of strings (entity names) into embeddings.

import numpy as np
import torch
from tqdm.auto import tqdm
from transformers import AutoTokenizer, AutoModel  

tokenizer = AutoTokenizer.from_pretrained("cambridgeltl/SapBERT-from-PubMedBERT-fulltext")  
model = AutoModel.from_pretrained("cambridgeltl/SapBERT-from-PubMedBERT-fulltext").cuda()

# replace with your own list of entity names
all_names = ["covid-19", "Coronavirus infection", "high fever", "Tumor of posterior wall of oropharynx"] 

bs = 128 # batch size during inference
all_embs = []
for i in tqdm(np.arange(0, len(all_names), bs)):
    toks = tokenizer.batch_encode_plus(all_names[i:i+bs], 
                                       padding="max_length", 
                                       max_length=25, 
                                       truncation=True,
                                       return_tensors="pt")
    toks_cuda = {}
    for k,v in toks.items():
        toks_cuda[k] = v.cuda()
    cls_rep = model(**toks_cuda)[0][:,0,:] # use CLS representation as the embedding
    all_embs.append(cls_rep.cpu().detach().numpy())

all_embs = np.concatenate(all_embs, axis=0)

For more details about training and eval, see SapBERT github repo.

Citation

@inproceedings{liu-etal-2021-self,
    title = "Self-Alignment Pretraining for Biomedical Entity Representations",
    author = "Liu, Fangyu  and
      Shareghi, Ehsan  and
      Meng, Zaiqiao  and
      Basaldella, Marco  and
      Collier, Nigel",
    booktitle = "Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies",
    month = jun,
    year = "2021",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/2021.naacl-main.334",
    pages = "4228--4238",
    abstract = "Despite the widespread success of self-supervised learning via masked language models (MLM), accurately capturing fine-grained semantic relationships in the biomedical domain remains a challenge. This is of paramount importance for entity-level tasks such as entity linking where the ability to model entity relations (especially synonymy) is pivotal. To address this challenge, we propose SapBERT, a pretraining scheme that self-aligns the representation space of biomedical entities. We design a scalable metric learning framework that can leverage UMLS, a massive collection of biomedical ontologies with 4M+ concepts. In contrast with previous pipeline-based hybrid systems, SapBERT offers an elegant one-model-for-all solution to the problem of medical entity linking (MEL), achieving a new state-of-the-art (SOTA) on six MEL benchmarking datasets. In the scientific domain, we achieve SOTA even without task-specific supervision. With substantial improvement over various domain-specific pretrained MLMs such as BioBERT, SciBERTand and PubMedBERT, our pretraining scheme proves to be both effective and robust.",
}

Magnet link

Opens the swarm directly in your torrent client — no file download needed. Copy-paste works too:

magnet:?xt=urn:btih:f7098ec6e9533b1bb15bc1f7ef199af0a6930cb1&dn=cambridgeltl_SapBERT-from-PubMedBERT-fulltext

Open magnet in torrent client · infohash f7098ec6e9533b1bb15bc1f7ef199af0a6930cb1

Files & hashes

PathSizesha1sha256
README.md4.0 KB (4,084 B)ea62f798faf3a50a90727431a0e54bda1b021c57377c2a56de9d04fe7c33691e24da24d585c077681a16bce1917a6cc140a99ed1
config.json462 B (462 B)8342f3adf937298e71303d4b7e7a605689e5a844c0fa35def52bf7d81865d23dba0417fdbb67d416fdde70cae5c7beab476b584e
model.safetensors417.7 MB (437,955,508 B)244206b4002a9329dff5882c876664a372744a71a4696930afef9aab296196d3d2142216c44cba24f21b4f285ceca7af21025614
pytorch_model.bin417.7 MB (438,012,727 B)ce0f10bca31bdad547485f8ebe386622d57d03ff07f7672c7ac852d8efff83e4a7a63985bf50c03d5b57f6a7909c11fe66532137
special_tokens_map.json112 B (112 B)e7b0375001f109a6b8873d756ad4f7bbb15fbaa5303df45a03609e4ead04bc3dc1536d0ab19b5358db685b6f3da123d05ec200e3
tokenizer_config.json198 B (198 B)ced838ef749c8e8f92fb03d14a4e7e24bc71e20776eb84b4b5b0d1bdba02906d7fae249be541c41d72e2024094aea513f98f2be7
vocab.txt220.8 KB (226,150 B)9d595d9c20feef7012f174efaaa5eb621910588e79489a52be45e6fa033521e8ce8e4f62aedc0a742ee2aa6fc04667e5b0b1454d

Cite this release

Canonical URL
https://aiseedbank.org/models/cambridgeltl_SapBERT-from-PubMedBERT-fulltext/
Slug
cambridgeltl_SapBERT-from-PubMedBERT-fulltext
Infohash
f7098ec6e9533b1bb15bc1f7ef199af0a6930cb1
License
apache-2.0
Signing key fingerprint
85a3b32c3712427b

Every file carries a locally computed sha256 — verify a download against the signed sums: cambridgeltl_SapBERT-from-PubMedBERT-fulltext.SHA256SUMS (+ minisign signature).

Provenance

Upstream repositorycambridgeltl/SapBERT-from-PubMedBERT-fulltext
Revision (pinned)090663c3ae57bf35ffe4d0d468a2a88d03051a4d
Fetched at2026-09-03T21:11:05Z
License at fetchapache-2.0
Snapshot toolhuggingface · seedbank 0.1.0

Trackers

✓ verified · rehash-vs-hf-metadata at 2026-09-03T21:11:16Z

apache-2.0835.6 MB (876,199,241 bytes)transformerspytorchjaxsafetensorsbertfeature-extractionbiomedicallexical semanticsbionlpbiologyscienceembeddingentity linkingendpoints_compatible2 languages (tf, en)paper: 2010.11784