英文

ProtBert 模型

ProtBert 是基于 Bert 模型在蛋白质序列上进行预训练的,采用掩码语言建模(MLM)目标。它于 this paper 年提出,并于 this repository 年首次发布。该模型仅针对大写的氨基酸进行训练:它只能处理大写字母的氨基酸。

模型描述

ProtBert 基于 Bert 模型,在自监督方式下对大规模蛋白质序列语料进行预训练。这意味着它仅使用原始蛋白质序列进行预训练,没有人类以任何方式对其进行标注(这就是为什么它可以使用大量的公开数据),使用自动过程从这些蛋白质序列生成输入和标签。

我们的 Bert 模型与原始的 Bert 版本之间的一个重要差异是处理序列作为独立文档的方式。这意味着我们不使用下一个句子预测任务,因为每个序列被视为完整的文档。掩码操作遵循原始的 Bert 训练方式,在输入中随机掩码了15%的氨基酸。

最终,从该模型提取的特征表明,从未标记数据(仅蛋白质序列)中提取的语言模型嵌入能够捕捉到控制蛋白质形状的重要生物物理性质。这意味着它学习到了在蛋白质序列中体现的生命语言的一些语法。

预期用途和限制

该模型可用于蛋白质特征提取或在下游任务中进行微调。我们观察到,在某些任务中,通过微调模型而不仅仅使用它作为特征提取器,可以获得更高的准确性。

如何使用

您可以直接使用该模型进行掩码语言建模的流水线处理:

>>> from transformers import BertForMaskedLM, BertTokenizer, pipeline
>>> tokenizer = BertTokenizer.from_pretrained("Rostlab/prot_bert", do_lower_case=False )
>>> model = BertForMaskedLM.from_pretrained("Rostlab/prot_bert")
>>> unmasker = pipeline('fill-mask', model=model, tokenizer=tokenizer)
>>> unmasker('D L I P T S S K L V V [MASK] D T S L Q V K K A F F A L V T')

[{'score': 0.11088453233242035,
  'sequence': '[CLS] D L I P T S S K L V V L D T S L Q V K K A F F A L V T [SEP]',
  'token': 5,
  'token_str': 'L'},
 {'score': 0.08402521163225174,
  'sequence': '[CLS] D L I P T S S K L V V S D T S L Q V K K A F F A L V T [SEP]',
  'token': 10,
  'token_str': 'S'},
 {'score': 0.07328339666128159,
  'sequence': '[CLS] D L I P T S S K L V V V D T S L Q V K K A F F A L V T [SEP]',
  'token': 8,
  'token_str': 'V'},
 {'score': 0.06921856850385666,
  'sequence': '[CLS] D L I P T S S K L V V K D T S L Q V K K A F F A L V T [SEP]',
  'token': 12,
  'token_str': 'K'},
 {'score': 0.06382402777671814,
  'sequence': '[CLS] D L I P T S S K L V V I D T S L Q V K K A F F A L V T [SEP]',
  'token': 11,
  'token_str': 'I'}]

下面是如何在 PyTorch 中使用此模型获取给定蛋白质序列的特征:

from transformers import BertModel, BertTokenizer
import re
tokenizer = BertTokenizer.from_pretrained("Rostlab/prot_bert", do_lower_case=False )
model = BertModel.from_pretrained("Rostlab/prot_bert")
sequence_Example = "A E T C Z A O"
sequence_Example = re.sub(r"[UZOB]", "X", sequence_Example)
encoded_input = tokenizer(sequence_Example, return_tensors='pt')
output = model(**encoded_input)

训练数据

ProtBert 模型在 Uniref100 数据集上进行了预训练,该数据集包含2.17亿个蛋白质序列。

训练过程

预处理

蛋白质序列经过大写处理和使用一个空格进行分词,并采用21个词汇量。罕见的氨基酸 "U,Z,O,B" 被映射为 "X"。然后,模型的输入形式为:

[CLS] Protein Sequence A [SEP] Protein Sequence B [SEP]

此外,每个蛋白质序列均被视为一个单独的文档。预处理步骤进行了两次,一次用于总长度(2个序列)小于512个氨基酸,另一次用于总长度(2个序列)小于2048个氨基酸。

每个序列进行屏蔽的具体步骤遵循原始的 Bert 模型:

  • 15% 的氨基酸被屏蔽。
  • 在 80% 的情况下,屏蔽的氨基酸被替换为 [MASK]。
  • 在 10% 的情况下,屏蔽的氨基酸被替换为与其不同的随机氨基酸。
  • 在剩余的 10% 情况下,屏蔽的氨基酸保持不变。

预训练

该模型在一个 TPU Pod V3-512 上进行了总计 40 万步的训练。其中300K步使用序列长度为512(批量大小为15K),100K步使用序列长度为2048(批量大小为2.5K)。优化器使用 Lamb,学习速率为0.002,权重衰减为0.01,学习速率预热步数为 40k,学习速率线性衰减。

评估结果

在下游任务中进行微调时,该模型实现了以下结果:

测试结果:

Task/Dataset secondary structure (3-states) secondary structure (8-states) Localization Membrane
CASP12 75 63
TS115 83 72
CB513 81 66
DeepLoc 79 91

BibTeX 引用及文献信息

@article {Elnaggar2020.07.12.199554,
    author = {Elnaggar, Ahmed and Heinzinger, Michael and Dallago, Christian and Rehawi, Ghalia and Wang, Yu and Jones, Llion and Gibbs, Tom and Feher, Tamas and Angerer, Christoph and Steinegger, Martin and BHOWMIK, DEBSINDHU and Rost, Burkhard},
    title = {ProtTrans: Towards Cracking the Language of Life{\textquoteright}s Code Through Self-Supervised Deep Learning and High Performance Computing},
    elocation-id = {2020.07.12.199554},
    year = {2020},
    doi = {10.1101/2020.07.12.199554},
    publisher = {Cold Spring Harbor Laboratory},
    abstract = {Computational biology and bioinformatics provide vast data gold-mines from protein sequences, ideal for Language Models (LMs) taken from Natural Language Processing (NLP). These LMs reach for new prediction frontiers at low inference costs. Here, we trained two auto-regressive language models (Transformer-XL, XLNet) and two auto-encoder models (Bert, Albert) on data from UniRef and BFD containing up to 393 billion amino acids (words) from 2.1 billion protein sequences (22- and 112 times the entire English Wikipedia). The LMs were trained on the Summit supercomputer at Oak Ridge National Laboratory (ORNL), using 936 nodes (total 5616 GPUs) and one TPU Pod (V3-512 or V3-1024). We validated the advantage of up-scaling LMs to larger models supported by bigger data by predicting secondary structure (3-states: Q3=76-84, 8 states: Q8=65-73), sub-cellular localization for 10 cellular compartments (Q10=74) and whether a protein is membrane-bound or water-soluble (Q2=89). Dimensionality reduction revealed that the LM-embeddings from unlabeled data (only protein sequences) captured important biophysical properties governing protein shape. This implied learning some of the grammar of the language of life realized in protein sequences. The successful up-scaling of protein LMs through HPC to larger data sets slightly reduced the gap between models trained on evolutionary information and LMs. Availability ProtTrans: \<a href="https://github.com/agemagician/ProtTrans"\>https://github.com/agemagician/ProtTrans\</a\>Competing Interest StatementThe authors have declared no competing interest.},
    URL = {https://www.biorxiv.org/content/early/2020/07/21/2020.07.12.199554},
    eprint = {https://www.biorxiv.org/content/early/2020/07/21/2020.07.12.199554.full.pdf},
    journal = {bioRxiv}
}

创建者: Ahmed Elnaggar/@Elnaggar_AI | LinkedIn