Views
No views yet
| Model | ESM2(3B) | ESM2 (15B) | PGLM (1B) | PGLM (3B) | PGLM (10B) | PGLM-INT4 (100B) |
|---|---|---|---|---|---|---|
| < 0.9 ID | 7.7 | 7.3 | 9.3 | 7.8 | 7.6 | 6.8 |
| < 0.5 ID | 11.5 | 11.0 | 13.5 | 11.9 | 11.6 | 10.8 |
1
2# Obtain residue embeddings
3from transformers import AutoModelForMaskedLM, AutoModelForSequenceClassification, AutoModelForTokenClassification, AutoTokenizer, AutoConfig
4import torch
5
6tokenizer = AutoTokenizer.from_pretrained("Bo1015/proteinglm-3b-mlm", trust_remote_code=True, use_fast=True)
7model = AutoModelForMaskedLM.from_pretrained("Bo1015/proteinglm-3b-mlm", trust_remote_code=True, torch_dtype=torch.bfloat16)
8if torch.cuda.is_available():
9 model = model.cuda()
10model.eval()
11
12seq = 'MILMCQHFSGQFSKYFLAVSSDFCHFVFPIILVSHVNFKQMKRKGFALWNDRAVPFTQGIFTTVMILLQYLHGTG'
13output = tokenizer(seq, add_special_tokens=True, return_tensors='pt')
14with torch.inference_mode():
15 inputs = {"input_ids": output["input_ids"].cuda(), "attention_mask": output["attention_mask"].cuda()}
16 output_embeddings = model(**inputs, output_hidden_states=True, return_last_hidden_state=True).hidden_states[:-1, 0] # get rid of the <eos> token
17
18
19# model for the sequence-level tasks
20model = AutoModelForSequenceClassification.from_pretrained("Bo1015/proteinglm-3b-mlm", trust_remote_code=True, torch_dtype=torch.bfloat16)
21
22# model for the token-level tasks
23model = AutoModelForTokenClassification.from_pretrained("Bo1015/proteinglm-3b-mlm", trust_remote_code=True, torch_dtype=torch.bfloat16)
24@misc{chen2024xtrimopglm,
title={xTrimoPGLM: unified 100B-scale pre-trained transformer for deciphering the language of protein},
author={Chen, Bo and Cheng, Xingyi and Li, Pan and Geng, Yangli-ao and Gong, Jing and Li, Shen and Bei, Zhilei and Tan, Xu and Wang, Boyan and Zeng, Xin and others},
year={2024},
eprint={2401.06199},
archivePrefix={arXiv},
primaryClass={cs.CL},
note={arXiv preprint arXiv:2401.06199}
}
@misc{cheng2024training,
title={Training Compute-Optimal Protein Language Models},
author={Cheng, Xingyi and Chen, Bo and Li, Pan and Gong, Jing and Tang, Jie and Song, Le},
year={2024},
note={bioRxiv, Cold Spring Harbor Laboratory, pages 2024--06}
}