Downloads · 30 days
109
3% of all-time downloads
Takagi-san/SaProt_650M_AF2
SaProt_650M_AF2 is a fill-mask model from Takagi-san. Use it when you need the model to fill a missing word. It is set up for transformers. The card lists the license as mit.
We provide both huggingface version and esm version of SaProt (see our github <https://github.com/SaProt/SaProt). Users can choose either one to use.
Downloads · 30 days
109
3% of all-time downloads
All-time downloads
4K
Public
Repo size
7.8 GB
Likes
2
Public
Click a slice to open those files.
.bin2.6 GB · 50%
From the Hugging Face model README
We provide both huggingface version and esm version of SaProt (see our github https://github.com/SaProt/SaProt). Users can choose either one to use.
The following code shows how to load the model.
from transformers import EsmTokenizer, EsmForMaskedLM
model_path = "/your/path/to/SaProt_650M_AF2"
tokenizer = EsmTokenizer.from_pretrained(model_path)
model = EsmForMaskedLM.from_pretrained(model_path)
#################### Example ####################
device = "cuda"
model.to(device)
seq = "MdEvVpQpLrVyQdYaKv"
tokens = tokenizer.tokenize(seq)
print(tokens)
inputs = tokenizer(seq, return_tensors="pt")
inputs = {k: v.to(device) for k, v in inputs.items()}
outputs = model(**inputs)
print(outputs.logits.shape)
"""
['Md', 'Ev', 'Vp', 'Qp', 'Lr', 'Vy', 'Qd', 'Ya', 'Kv']
torch.Size([1, 11, 446])
"""
The esm version is also stored in the same folder, named SaProt_650M_AF2.pt. We provide a function to load the model.
from utils.esm_loader import load_esm_saprot
model_path = "/your/path/to/SaProt_650M_AF2.pt"
model, alphabet = load_esm_saprot(model_path)