Downloads · 30 days
346
11% of all-time downloads
fredzzp/esm2_t6_8M_UR50D
esm2_t6_8M_UR50D is a fill-mask model from fredzzp. 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.
This is an efficient Flash Attention implementation of ESM2 (Evolutionary Scale Modeling) that provides nearly 50% speedup and memory reduction compared to the original implementation. All the source code is from FAPL…
Downloads · 30 days
346
11% of all-time downloads
All-time downloads
3.1K
Public
Parameters
7.8M
31.4 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors31.4 MB · 100%
From the Hugging Face model README
This is an efficient Flash Attention implementation of ESM2 (Evolutionary Scale Modeling) that provides nearly 50% speedup and memory reduction compared to the original implementation. All the source code is from FAPLM. Give us a star if you find it useful :)
# Install PyTorch (if not already installed)
pip install torch
# Install Flash Attention (optional, for best performance)
pip install flash-attn --no-build-isolation --no-cache-dir
# Install huggingface
pip install transformers
One change the repo name and turn on trust_remote_code=True.
from transformers import AutoModelForMaskedLM, AutoTokenizer
model = AutoModelForMaskedLM.from_pretrained("fredzzp/esm2_t33_650M_UR50D", trust_remote_code=True).to("cuda").eval().half()
tokenizer = AutoTokenizer.from_pretrained("fredzzp/esm2_t33_650M_UR50D")
input_ids = tokenizer("AGC", return_tensors="pt").input_ids.to("cuda")
output = model(input_ids)
print(output['logits'].shape)
print(output['last_hidden_state'].shape)
| Model | Num Layers | Num Parameters |
|---|---|---|
| fredzzp/esm2_t36_3B_UR50D | 36 | 3B |
| fredzzp/esm2_t33_650M_UR50D | 33 | 650M |
| fredzzp/esm2_t30_150M_UR50D | 30 | 150M |
| fredzzp/esm2_t12_35M_UR50D | 12 | 35M |
| fredzzp/esm2_t6_8M_UR50D | 6 | 8M |
If you use this implementation, please cite both the original ESM2 paper and this work:
@article{lin2023evolutionary,
title={Evolutionary-scale prediction of atomic-level protein structure with a language model},
author={Lin, Zeming and Akin, Halil and Rao, Roshan and Hie, Brian and Zhu, Zihang and Lu, Wenting and Smetanin, Nikita and Verkuil, Robert and Kabeli, Ori and Shmueli, Yair and others},
journal={Science},
volume={379},
number={6637},
pages={1123--1130},
year={2023},
publisher={American Association for the Advancement of Science}
}
@misc{faesm2024,
author = {Fred Zhangzhi Peng, Pranam Chatterjee, and contributors},
title = {FAESM: An efficient PyTorch implementation of Evolutionary Scale Modeling (ESM)},
year = {2024},
howpublished = {\url{https://github.com/pengzhangzhi/faesm}},
note = {Efficient PyTorch implementation of ESM with FlashAttention and Scalar Dot-Product Attention (SDPA)},
abstract = {FAESM is a drop-in replacement for the official ESM implementation, designed to save up to 60% memory usage and 70% inference time, while maintaining compatibility with the ESM API.},
}
This implementation is licensed under the MIT License. The ESM2 model weights maintain their original licensing terms.