Prollama
ProLLaMA是基於Llama-2-7b構建的蛋白質大語言模型,專注於多任務蛋白質語言處理,能夠執行蛋白質序列生成和超家族判定任務。
下載量 366
發布時間 : 2/24/2024
模型概述
ProLLaMA是一個面向蛋白質語言處理的大語言模型,支持蛋白質序列生成和超家族判定兩大核心功能,適用於生物信息學和蛋白質工程研究。
模型特點
多任務處理能力
同時支持蛋白質序列生成和超家族判定兩大核心功能
超家族特異性生成
可根據指定的蛋白質超家族生成具有結構特徵的蛋白質序列
序列起始控制
支持指定生成序列的起始氨基酸序列
模型能力
蛋白質序列生成
蛋白質超家族分類
生物序列分析
使用案例
生物信息學
新型蛋白質設計
基於特定超家族生成具有潛在功能的新蛋白質序列
可生成符合目標超家族結構特徵的合理序列
蛋白質功能預測
通過超家族判定預測未知蛋白質的可能功能
可準確分類蛋白質到已知功能超家族
蛋白質工程
蛋白質優化
生成具有特定超家族特徵的優化序列
可獲得保持功能特性的改進序列
🚀 ProLLaMA:用於多任務蛋白質語言處理的蛋白質大語言模型
ProLLaMA是一個用於多任務蛋白質語言處理的蛋白質大語言模型,它基於Llama - 2 - 7b構建,能根據輸入指令完成蛋白質超家族相關的生成與判定任務。
由於ProLLaMA基於Llama - 2 - 7b,因此請遵循Llama2的許可協議。
🚀 快速開始
# 你可以將model_path替換為你的本地路徑
CUDA_VISIBLE_DEVICES=0 python main.py --model "GreatCaptainNemo/ProLLaMA" --interactive
# main.py代碼如下 👇:
import argparse
import json, os
import torch
from transformers import LlamaForCausalLM, LlamaTokenizer
from transformers import GenerationConfig
from tqdm import tqdm
generation_config = GenerationConfig(
temperature=0.2,
top_k=40,
top_p=0.9,
do_sample=True,
num_beams=1,
repetition_penalty=1.2,
max_new_tokens=400
)
parser = argparse.ArgumentParser()
parser.add_argument('--model', default=None, type=str,help="The local path of the model. If None, the model will be downloaded from HuggingFace")
parser.add_argument('--interactive', action='store_true',help="If True, you can input instructions interactively. If False, the input instructions should be in the input_file.")
parser.add_argument('--input_file', default=None, help="You can put all your input instructions in this file (one instruction per line).")
parser.add_argument('--output_file', default=None, help="All the outputs will be saved in this file.")
args = parser.parse_args()
if __name__ == '__main__':
if args.interactive and args.input_file:
raise ValueError("interactive is True, but input_file is not None.")
if (not args.interactive) and (args.input_file is None):
raise ValueError("interactive is False, but input_file is None.")
if args.input_file and (args.output_file is None):
raise ValueError("input_file is not None, but output_file is None.")
load_type = torch.bfloat16
if torch.cuda.is_available():
device = torch.device(0)
else:
raise ValueError("No GPU available.")
model = LlamaForCausalLM.from_pretrained(
args.model,
torch_dtype=load_type,
low_cpu_mem_usage=True,
device_map='auto',
quantization_config=None
)
tokenizer = LlamaTokenizer.from_pretrained(args.model)
model.eval()
with torch.no_grad():
if args.interactive:
while True:
raw_input_text = input("Input:")
if len(raw_input_text.strip())==0:
break
input_text = raw_input_text
input_text = tokenizer(input_text,return_tensors="pt")
generation_output = model.generate(
input_ids = input_text["input_ids"].to(device),
attention_mask = input_text['attention_mask'].to(device),
eos_token_id=tokenizer.eos_token_id,
pad_token_id=tokenizer.pad_token_id,
generation_config = generation_config,
output_attentions=False
)
s = generation_output[0]
output = tokenizer.decode(s,skip_special_tokens=True)
print("Output:",output)
print("\n")
else:
outputs=[]
with open(args.input_file, 'r') as f:
examples =f.read().splitlines()
print("Start generating...")
for index, example in tqdm(enumerate(examples),total=len(examples)):
input_text = tokenizer(example,return_tensors="pt") #add_special_tokens=False ?
generation_output = model.generate(
input_ids = input_text["input_ids"].to(device),
attention_mask = input_text['attention_mask'].to(device),
eos_token_id=tokenizer.eos_token_id,
pad_token_id=tokenizer.pad_token_id,
generation_config = generation_config
)
s = generation_output[0]
output = tokenizer.decode(s,skip_special_tokens=True)
outputs.append(output)
with open(args.output_file,'w') as f:
f.write("\n".join(outputs))
print("All the outputs have been saved in",args.output_file)
💻 使用示例
基礎用法
輸入到模型的指令應遵循以下格式:
[Generate by superfamily] Superfamily=<xxx>
或者
[Determine superfamily] Seq=<yyy>
以下是一些輸入示例:
[Generate by superfamily] Superfamily=<Ankyrin repeat-containing domain superfamily>
# 你也可以指定蛋白質序列的前幾個氨基酸:
[Generate by superfamily] Superfamily=<Ankyrin repeat-containing domain superfamily> Seq=<MKRVL
[Determine superfamily] Seq=<MAPGGMPREFPSFVRTLPEADLGYPALRGWVLQGERGCVLYWEAVTEVALPEHCHAECWGVVVDGRMELMVDGYTRVYTRGDLYVVPPQARHRARVFPGFRGVEHLSDPDLLPVRKR>
查看此處獲取所有可選的超家族。
📄 許可證
本項目採用Apache - 2.0許可證。
📚 引用
@article{lv2024prollama,
title={ProLLaMA: A Protein Large Language Model for Multi-Task Protein Language Processing},
author={Lv, Liuzhenghao and Lin, Zongying and Li, Hao and Liu, Yuyang and Cui, Jiaxi and Chen, Calvin Yu-Chian and Yuan, Li and Tian, Yonghong},
journal={arXiv preprint arXiv:2402.16445},
year={2024}
}
Esm2 T36 3B UR50D
MIT
ESM-2是基於掩碼語言建模目標訓練的新一代蛋白質模型,適用於各類以蛋白質序列為輸入的下游任務微調。
蛋白質模型
Transformers

E
facebook
3.5M
22
Esm2 T6 8M UR50D
MIT
ESM-2是基於掩碼語言建模目標訓練的新一代蛋白質模型,適用於對蛋白質序列進行各類任務的微調。
蛋白質模型
Transformers

E
facebook
1.5M
21
Esm2 T33 650M UR50D
MIT
ESM-2是基於掩碼語言建模目標訓練的最先進蛋白質模型,適用於對蛋白質序列進行分析和預測任務
蛋白質模型
Transformers

E
facebook
640.23k
41
Esm2 T12 35M UR50D
MIT
ESM-2是基於掩碼語言建模目標訓練的前沿蛋白質模型,適用於各類蛋白質序列分析任務
蛋白質模型
Transformers

E
facebook
332.83k
15
Prot Bert
基於BERT架構的蛋白質序列預訓練模型,通過自監督學習捕捉蛋白質序列的生物物理特性
蛋白質模型
Transformers

P
Rostlab
276.10k
111
Prostt5
MIT
ProstT5是一種蛋白質語言模型,能夠在蛋白質序列與結構之間進行翻譯。
蛋白質模型
Transformers

P
Rostlab
252.91k
23
Prot T5 Xl Uniref50
基於T5-3B架構的蛋白質序列預訓練模型,通過自監督學習捕捉蛋白質的生物物理特性
蛋白質模型
Transformers

P
Rostlab
78.45k
44
Esm2 T30 150M UR50D
MIT
ESM-2是基於遮蔽語言建模目標訓練的最先進蛋白質模型,適用於對各類以蛋白質序列為輸入的任務進行微調。
蛋白質模型
Transformers

E
facebook
69.91k
7
Prot Bert Bfd
基於Bert架構的蛋白質序列預訓練模型,通過自監督學習從21億蛋白質序列中提取生物物理特徵
蛋白質模型
Transformers

P
Rostlab
30.60k
16
Esm1b T33 650M UR50S
MIT
ESM-1b是基於Transformer的蛋白質語言模型,通過無監督學習蛋白質序列數據,可用於蛋白質結構和功能預測。
蛋白質模型
Transformers

E
facebook
24.20k
18
精選推薦AI模型
Llama 3 Typhoon V1.5x 8b Instruct
專為泰語設計的80億參數指令模型,性能媲美GPT-3.5-turbo,優化了應用場景、檢索增強生成、受限生成和推理任務
大型語言模型
Transformers 支持多種語言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一個基於SODA數據集訓練的超小型對話模型,專為邊緣設備推理設計,體積僅為Cosmo-3B模型的2%左右。
對話系統
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基於RoBERTa架構的中文抽取式問答模型,適用於從給定文本中提取答案的任務。
問答系統 中文
R
uer
2,694
98