Update README.md
Browse files
README.md
CHANGED
|
@@ -1,259 +1,19 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
| 4 |
|
| 5 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
|
| 9 |
-
This modelcard aims to be a base template for new models. It has been generated using [this raw template](https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/templates/modelcard_template.md?plain=1).
|
| 10 |
-
|
| 11 |
-
## Model Details
|
| 12 |
-
|
| 13 |
-
### Model Description
|
| 14 |
-
|
| 15 |
-
<!-- Provide a longer summary of what this model is. -->
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
- **Developed by:** [More Information Needed]
|
| 20 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 21 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 22 |
-
- **Model type:** [More Information Needed]
|
| 23 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 24 |
-
- **License:** [More Information Needed]
|
| 25 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 26 |
-
|
| 27 |
-
### Model Sources [optional]
|
| 28 |
-
|
| 29 |
-
<!-- Provide the basic links for the model. -->
|
| 30 |
-
|
| 31 |
-
- **Repository:** [More Information Needed]
|
| 32 |
-
- **Paper [optional]:** [More Information Needed]
|
| 33 |
-
- **Demo [optional]:** [More Information Needed]
|
| 34 |
-
|
| 35 |
-
## Uses
|
| 36 |
-
|
| 37 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 38 |
-
|
| 39 |
-
### Direct Use
|
| 40 |
-
|
| 41 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 42 |
-
```python
|
| 43 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 44 |
-
import torch
|
| 45 |
-
|
| 46 |
-
tokenizer = AutoTokenizer.from_pretrained('InstructPLM/MPNN-ProGen2-xlarge-CATH42', trust_remote_code=True)
|
| 47 |
-
model = AutoModelForCausalLM.from_pretrained('InstructPLM/MPNN-ProGen2-xlarge-CATH42', trust_remote_code=True)
|
| 48 |
-
|
| 49 |
-
model.cuda().eval()
|
| 50 |
-
model.requires_grad_(False)
|
| 51 |
-
|
| 52 |
-
batch = tokenizer('Fast-PETase.pyd|1MQTNPYARGPNPTAASLEASAGPFTVRSFTVSRPSGYGAGTVYYPTNAGGTVGAIAIVPGYTARQSSIKWWGPRLASHGFVVITIDTNSTLDQPESRSSQQMAALRQVASLNGTSSSPIYGKVDTARMGVMGWSMGGGGSLISAANNPSLKAAAPQAPWHSSTNFSSVTVPTLIFACENDSIAPVNSSALPIYDSMSQNAKQFLEIKGGSHSCANSGNSNQALIGKKGVAWMKRFMDNDTRYSTFACENPNSTAVSDFRTANCS2',return_tensors='pt').to(device=model.device)
|
| 53 |
-
|
| 54 |
-
labels = batch.input_ids.masked_fill((1-batch.attention_mask).bool(), -100)
|
| 55 |
-
labels[:, :tokenizer.n_queries+1] = -100
|
| 56 |
-
|
| 57 |
-
batch["labels"] = labels
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
with torch.no_grad():
|
| 61 |
-
with torch.cuda.amp.autocast(dtype=torch.float16):
|
| 62 |
-
output = model(**batch)
|
| 63 |
-
|
| 64 |
-
print(output.loss.item())
|
| 65 |
-
|
| 66 |
-
batch = tokenizer('Fast-PETase.pyd|1',return_tensors='pt').to(device=model.device)
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
tokens_batch = model.generate(
|
| 70 |
-
**batch,
|
| 71 |
-
do_sample=True,
|
| 72 |
-
temperature=0.8,
|
| 73 |
-
max_length=512+tokenizer.n_queries,
|
| 74 |
-
min_new_tokens=5,
|
| 75 |
-
top_p=0.9,
|
| 76 |
-
num_return_sequences=5,
|
| 77 |
-
pad_token_id=0,
|
| 78 |
-
repetition_penalty=1.0,
|
| 79 |
-
bad_words_ids=[[3]]
|
| 80 |
-
)
|
| 81 |
-
|
| 82 |
-
texts = tokenizer.batch_decode(tokens_batch)
|
| 83 |
-
|
| 84 |
-
def truncate_seq(text):
|
| 85 |
-
bos = text.find('1')
|
| 86 |
-
eos = text.find('2')
|
| 87 |
-
if eos > bos and bos >= 0:
|
| 88 |
-
return text[bos+1:eos]
|
| 89 |
-
else:
|
| 90 |
-
return text[bos+1:]
|
| 91 |
-
print([truncate_seq(t) for t in texts])
|
| 92 |
-
|
| 93 |
-
# Ref. Seq
|
| 94 |
-
# 'MQTNPYARGPNPTAASLEASAGPFTVRSFTVSRPSGYGAGTVYYPTNAGGTVGAIAIVPGYTARQSSIKWWGPRLASHGFVVITIDTNSTLDQPESRSSQQMAALRQVASLNGTSSSPIYGKVDTARMGVMGWSMGGGGSLISAANNPSLKAAAPQAPWHSSTNFSSVTVPTLIFACENDSIAPVNSSALPIYDSMSQNAKQFLEIKGGSHSCANSGNSNQALIGKKGVAWMKRFMDNDTRYSTFACENPNSTAVSDFRTANCS'
|
| 95 |
-
# Designed seq:
|
| 96 |
-
# 'METNPFHRGPDPTCASLEAGAGPFNVQSFRVDRPLGFGAGTVFYPTDAGGQVPAIAIAPGFTQTQSSVMWYGPRLASHGFVVIVIDTISTFDNPDSRSAQLLAALDQVANLNSNASSPIYGKVDTTRQAVMGHSMGGGGSLISAMNNPSLKAAAPMAPWHVSTNFSAVQVPTFIIGAENDTIAPVASHSIPFYNSIPSSLPKAYMELAGASHLAPNSSNPTIAKYSISWLKRFVDNDTRYEQFLCPAPTSTALISEYRDTCPY',
|
| 97 |
-
# 'EETNPYSKGPDPTAASLEASAGPFTVQSFSVARPLGFGAGTVYYPTDAGGKVGAIAVVPGYTDTQGSIRWWGPRLASHGFVVMTIDTISSYDQPDSRSAQLMAALDQLANLNSTSSSPIYNKVDTTRQAVMGHSMGGGGSLISAMNNPNLKAAIPMAPWHSSTNFSSVKVPTMILGAERDTVAPVSSHAEPFYNSLPSSTPKAYLELKGASHFFPNTTNTPTFAKSVLAWLKRFVDNDTRYEQFLCPGPTSTDLTDYRNTCPY',
|
| 98 |
-
# 'SETNPYIKGPDPTAASLEASAGAFTVQSFTVSRPTGFGAGTVYYPTDAGGRVGAIAIVPGYTATQSSIKWWGPRLASHGFVVMTIDTNSTYDQPDSRANQLMAALDQLTNLNSTRSSPIYGKVDTTRQGVMGHSMGGGGSLIAAQDNPNLKAAIPLAPWHSSSNFSSVTVPTLIIGAQNDTVAPVSSHSIPFYTSLPSSLDKAYLELNGASHFAPNSSNTTIAKYSISWLKRFIDNDTRYEQFLCPPPSGSALISEYRNTCPY',
|
| 99 |
-
# 'EETWPYHRGPDPTAASLEASAGPFTVQSFTVARPLGFGAGTVYYPTDAGGRVGAVAVVPGYTQTQSAIRWWGPRLASHGFVVMTIDTISTFDQPDSRSAQLLAALDQLAVLNSTRSSPIYNKVDTTRQGVMGHSMGGGGSLISAMNNPSLKAAVPLAPWHASTNFSNVQVPTLIIGASDDTTASVTTHSIPFYNSIPSSVPKAYLELQGQSHFCPNTSNTTIAKYSISWLKRFIDNDTRYDQFLCPPPNGSAISDYRSTCPH',
|
| 100 |
-
# 'METNPFIRGPNPTAASLEASAGPFQVSSFSVARPVGFGAGTVYYPTDAGGQVPAIAIAPGFTQTQASVKWYGPRLASHGFVVIVIDTNSTLDNPDSRSAQLLAALDQVSTLNSSSSSPIYGKVDTTRQGVMGHSMGGGGSLISAQNNPALKAAIPLAPWHVSTDFSGVTVPTLIIGAENDTVAPVGTHAEPFYNSIPSSTPKAYLELNNASHFAPNTSNTTIAKYSIAWLKRFVDNDTRYDQFLCPAPNGNAIQDYRDTCPH'
|
| 101 |
-
#
|
| 102 |
-
```
|
| 103 |
-
|
| 104 |
-
[More Information Needed]
|
| 105 |
-
|
| 106 |
-
### Downstream Use [optional]
|
| 107 |
-
|
| 108 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 109 |
-
|
| 110 |
-
[More Information Needed]
|
| 111 |
-
|
| 112 |
-
### Out-of-Scope Use
|
| 113 |
-
|
| 114 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 115 |
-
|
| 116 |
-
[More Information Needed]
|
| 117 |
-
|
| 118 |
-
## Bias, Risks, and Limitations
|
| 119 |
-
|
| 120 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 121 |
-
|
| 122 |
-
[More Information Needed]
|
| 123 |
-
|
| 124 |
-
### Recommendations
|
| 125 |
-
|
| 126 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 127 |
-
|
| 128 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 129 |
-
|
| 130 |
-
## How to Get Started with the Model
|
| 131 |
-
|
| 132 |
-
Use the code below to get started with the model.
|
| 133 |
-
|
| 134 |
-
[More Information Needed]
|
| 135 |
-
|
| 136 |
-
## Training Details
|
| 137 |
-
|
| 138 |
-
### Training Data
|
| 139 |
-
|
| 140 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 141 |
-
|
| 142 |
-
[More Information Needed]
|
| 143 |
-
|
| 144 |
-
### Training Procedure
|
| 145 |
-
|
| 146 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 147 |
-
|
| 148 |
-
#### Preprocessing [optional]
|
| 149 |
-
|
| 150 |
-
[More Information Needed]
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
#### Training Hyperparameters
|
| 154 |
-
|
| 155 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 156 |
-
|
| 157 |
-
#### Speeds, Sizes, Times [optional]
|
| 158 |
-
|
| 159 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 160 |
-
|
| 161 |
-
[More Information Needed]
|
| 162 |
-
|
| 163 |
-
## Evaluation
|
| 164 |
-
|
| 165 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 166 |
-
|
| 167 |
-
### Testing Data, Factors & Metrics
|
| 168 |
-
|
| 169 |
-
#### Testing Data
|
| 170 |
-
|
| 171 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 172 |
-
|
| 173 |
-
[More Information Needed]
|
| 174 |
-
|
| 175 |
-
#### Factors
|
| 176 |
-
|
| 177 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 178 |
-
|
| 179 |
-
[More Information Needed]
|
| 180 |
-
|
| 181 |
-
#### Metrics
|
| 182 |
-
|
| 183 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 184 |
-
|
| 185 |
-
[More Information Needed]
|
| 186 |
-
|
| 187 |
-
### Results
|
| 188 |
-
|
| 189 |
-
[More Information Needed]
|
| 190 |
-
|
| 191 |
-
#### Summary
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
## Model Examination [optional]
|
| 196 |
-
|
| 197 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 198 |
-
|
| 199 |
-
[More Information Needed]
|
| 200 |
-
|
| 201 |
-
## Environmental Impact
|
| 202 |
-
|
| 203 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 204 |
-
|
| 205 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 206 |
-
|
| 207 |
-
- **Hardware Type:** [More Information Needed]
|
| 208 |
-
- **Hours used:** [More Information Needed]
|
| 209 |
-
- **Cloud Provider:** [More Information Needed]
|
| 210 |
-
- **Compute Region:** [More Information Needed]
|
| 211 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 212 |
-
|
| 213 |
-
## Technical Specifications [optional]
|
| 214 |
-
|
| 215 |
-
### Model Architecture and Objective
|
| 216 |
-
|
| 217 |
-
[More Information Needed]
|
| 218 |
-
|
| 219 |
-
### Compute Infrastructure
|
| 220 |
-
|
| 221 |
-
[More Information Needed]
|
| 222 |
-
|
| 223 |
-
#### Hardware
|
| 224 |
-
|
| 225 |
-
[More Information Needed]
|
| 226 |
-
|
| 227 |
-
#### Software
|
| 228 |
-
|
| 229 |
-
[More Information Needed]
|
| 230 |
-
|
| 231 |
-
## Citation [optional]
|
| 232 |
-
|
| 233 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 234 |
-
|
| 235 |
-
**BibTeX:**
|
| 236 |
-
|
| 237 |
-
[More Information Needed]
|
| 238 |
-
|
| 239 |
-
**APA:**
|
| 240 |
-
|
| 241 |
-
[More Information Needed]
|
| 242 |
-
|
| 243 |
-
## Glossary [optional]
|
| 244 |
-
|
| 245 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 246 |
-
|
| 247 |
-
[More Information Needed]
|
| 248 |
-
|
| 249 |
-
## More Information [optional]
|
| 250 |
-
|
| 251 |
-
[More Information Needed]
|
| 252 |
-
|
| 253 |
-
## Model Card Authors [optional]
|
| 254 |
-
|
| 255 |
-
[More Information Needed]
|
| 256 |
-
|
| 257 |
-
## Model Card Contact
|
| 258 |
-
|
| 259 |
-
[More Information Needed]
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
+
tags:
|
| 5 |
+
- biology
|
| 6 |
---
|
| 7 |
|
| 8 |
+
# InstrcutPLM
|
| 9 |
+
InstructPLM is a state-of-the-art protein design model based on [ProGen2](https://www.cell.com/cell-systems/abstract/S2405-4712(23)00272-7)
|
| 10 |
+
and [ProteinMPNN](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC9997061/)
|
| 11 |
+
and trained on [CATH 4.2](https://www.cathdb.info/) dataset.
|
| 12 |
+
It can design protein sequences that accurately conform to specified backbone structures.
|
| 13 |
+
<p align="center">
|
| 14 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/62a8397d839eeb3ef16a7566/1NRk65EImgBAFgvh8HJrA.png" alt="drawing" width="200"/>
|
| 15 |
+
</p>
|
| 16 |
+
Please visit our [repo](https://github.com/Eikor/InstructPLM) and [paper](https://github.com/Eikor/InstructPLM) for more information.
|
| 17 |
|
| 18 |
+
Please consider cite our paper and repo:
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|