julien-c HF staff commited on
Commit
7ae1d5c
1 Parent(s): 1b88e70

Migrate model card from transformers-repo

Browse files

Read announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/Rostlab/prot_t5_xl_bfd/README.md

Files changed (1) hide show
  1. README.md +125 -0
README.md ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: protein
3
+ tags:
4
+ - protein language model
5
+ datasets:
6
+ - BFD
7
+ ---
8
+
9
+ # ProtT5-XL-BFD model
10
+
11
+ Pretrained model on protein sequences using a masked language modeling (MLM) objective. It was introduced in
12
+ [this paper](https://doi.org/10.1101/2020.07.12.199554) and first released in
13
+ [this repository](https://github.com/agemagician/ProtTrans). This model is trained on uppercase amino acids: it only works with capital letter amino acids.
14
+
15
+
16
+ ## Model description
17
+
18
+ ProtT5-XL-BFD is based on the `t5-3b` model and was pretrained on a large corpus of protein sequences in a self-supervised fashion.
19
+ This means it was pretrained on the raw protein sequences only, with no humans labelling them in any way (which is why it can use lots of
20
+ publicly available data) with an automatic process to generate inputs and labels from those protein sequences.
21
+
22
+ One important difference between this T5 model and the original T5 version is the denosing objective.
23
+ The original T5-3B model was pretrained using a span denosing objective, while this model was pre-trained with a Bart-like MLM denosing objective.
24
+ The masking probability is consistent with the original T5 training by randomly masking 15% of the amino acids in the input.
25
+
26
+ It has been shown that the features extracted from this self-supervised model (LM-embeddings) captured important biophysical properties governing protein shape.
27
+ shape.
28
+ This implied learning some of the grammar of the language of life realized in protein sequences.
29
+
30
+ ## Intended uses & limitations
31
+
32
+ The model could be used for protein feature extraction or to be fine-tuned on downstream tasks.
33
+ We have noticed in some tasks on can gain more accuracy by fine-tuning the model rather than using it as a feature extractor.
34
+ We have also noticed that for feature extraction, its better to use the feature extracted from the encoder not from the decoder.
35
+
36
+ ### How to use
37
+
38
+ Here is how to use this model to extract the features of a given protein sequence in PyTorch:
39
+
40
+ ```python
41
+ from transformers import T5Tokenizer, T5Model
42
+ import re
43
+ import torch
44
+
45
+ tokenizer = T5Tokenizer.from_pretrained('Rostlab/prot_t5_xl_bfd', do_lower_case=False)
46
+
47
+ model = T5Model.from_pretrained("Rostlab/prot_t5_xl_bfd")
48
+
49
+ sequences_Example = ["A E T C Z A O","S K T Z P"]
50
+
51
+ sequences_Example = [re.sub(r"[UZOB]", "X", sequence) for sequence in sequences_Example]
52
+
53
+ ids = tokenizer.batch_encode_plus(sequences_Example, add_special_tokens=True, padding=True)
54
+
55
+ input_ids = torch.tensor(ids['input_ids'])
56
+ attention_mask = torch.tensor(ids['attention_mask'])
57
+
58
+ with torch.no_grad():
59
+ embedding = model(input_ids=input_ids,attention_mask=attention_mask,decoder_input_ids=None)
60
+
61
+ # For feature extraction we recommend to use the encoder embedding
62
+ encoder_embedding = embedding[2].cpu().numpy()
63
+ decoder_embedding = embedding[0].cpu().numpy()
64
+ ```
65
+
66
+ ## Training data
67
+
68
+ The ProtT5-XL-BFD model was pretrained on [BFD](https://bfd.mmseqs.com/), a dataset consisting of 2.1 billion protein sequences.
69
+
70
+ ## Training procedure
71
+
72
+ ### Preprocessing
73
+
74
+ The protein sequences are uppercased and tokenized using a single space and a vocabulary size of 21. The rare amino acids "U,Z,O,B" were mapped to "X".
75
+ The inputs of the model are then of the form:
76
+
77
+ ```
78
+ Protein Sequence [EOS]
79
+ ```
80
+
81
+ The preprocessing step was performed on the fly, by cutting and padding the protein sequences up to 512 tokens.
82
+
83
+ The details of the masking procedure for each sequence are as follows:
84
+ - 15% of the amino acids are masked.
85
+ - In 90% of the cases, the masked amino acids are replaced by `[MASK]` token.
86
+ - In 10% of the cases, the masked amino acids are replaced by a random amino acid (different) from the one they replace.
87
+
88
+ ### Pretraining
89
+
90
+ The model was trained on a single TPU Pod V3-1024 for 1.2 million steps in total, using sequence length 512 (batch size 4k).
91
+ It has a total of approximately 3B parameters and was trained using the encoder-decoder architecture.
92
+ The optimizer used is AdaFactor with inverse square root learning rate schedule for pre-training.
93
+
94
+
95
+ ## Evaluation results
96
+
97
+ When the model is used for feature etraction, this model achieves the following results:
98
+
99
+ Test results :
100
+
101
+ | Task/Dataset | secondary structure (3-states) | secondary structure (8-states) | Localization | Membrane |
102
+ |:-----:|:-----:|:-----:|:-----:|:-----:|
103
+ | CASP12 | 77 | 66 | | |
104
+ | TS115 | 85 | 74 | | |
105
+ | CB513 | 84 | 71 | | |
106
+ | DeepLoc | | | 77 | 91 |
107
+
108
+ ### BibTeX entry and citation info
109
+
110
+ ```bibtex
111
+ @article {Elnaggar2020.07.12.199554,
112
+ 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},
113
+ title = {ProtTrans: Towards Cracking the Language of Life{\textquoteright}s Code Through Self-Supervised Deep Learning and High Performance Computing},
114
+ elocation-id = {2020.07.12.199554},
115
+ year = {2020},
116
+ doi = {10.1101/2020.07.12.199554},
117
+ publisher = {Cold Spring Harbor Laboratory},
118
+ 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.},
119
+ URL = {https://www.biorxiv.org/content/early/2020/07/21/2020.07.12.199554},
120
+ eprint = {https://www.biorxiv.org/content/early/2020/07/21/2020.07.12.199554.full.pdf},
121
+ journal = {bioRxiv}
122
+ }
123
+ ```
124
+
125
+ > Created by [Ahmed Elnaggar/@Elnaggar_AI](https://twitter.com/Elnaggar_AI) | [LinkedIn](https://www.linkedin.com/in/prof-ahmed-elnaggar/)