Prollama Stage 1
ProLLaMA是一个基于Llama-2-7b架构的蛋白质大语言模型,专注于多任务蛋白质语言处理。
下载量 650
发布时间 : 4/25/2024
模型简介
ProLLaMA是一个专门为蛋白质序列处理设计的大语言模型,能够执行多种蛋白质相关任务,如序列生成和分析。
模型特点
多任务蛋白质语言处理
能够处理多种蛋白质相关任务,包括序列生成和分析。
基于Llama-2架构
利用Llama-2-7b的强大架构,优化蛋白质序列处理能力。
交互式使用
支持交互式输入蛋白质序列,实时生成分析结果。
模型能力
蛋白质序列生成
蛋白质序列分析
多任务蛋白质语言处理
使用案例
生物信息学
蛋白质序列生成
根据输入的蛋白质序列片段,生成完整的蛋白质序列。
生成符合生物学规律的蛋白质序列。
蛋白质序列分析
分析输入的蛋白质序列,预测其可能的结构和功能。
提供蛋白质序列的潜在功能和结构信息。
🚀 ProLLaMA:用于多任务蛋白质语言处理的蛋白质大语言模型
ProLLaMA 是一款专门为多任务蛋白质语言处理设计的蛋白质大语言模型,能够有效处理蛋白质相关的多种任务,为蛋白质研究提供强大的语言处理能力。
🚀 快速开始
输入格式
Seq=<
# 你也可以指定蛋白质序列的前几个氨基酸:
Seq=<MAPGGMPRE
快速使用
# 你可以将 model_path 替换为你本地的路径
CUDA_VISIBLE_DEVICES=0 python main.py --model "GreatCaptainNemo/ProLLaMA_Stage_1" --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)
📄 许可证
本项目采用 Apache-2.0 许可证。此外,ProLLaMA_Stage_1 基于 Llama-2-7b,因此请遵循 Llama2 的许可证。
📚 详细文档
📖 引用
如果你使用了本项目,请引用以下论文:
@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