Commit
•
e4f37c1
1
Parent(s):
4f439ab
Update README.md (#2)
Browse files- Update README.md (803b39bb741b49021ea553059e8e49360e191035)
Co-authored-by: Jiqing.Feng <[email protected]>
README.md
CHANGED
@@ -5,7 +5,7 @@ Current protein language models (PLMs) learn protein representations mainly base
|
|
5 |
![image/png](https://cdn-uploads.huggingface.co/production/uploads/62f0a673f0d40f6aae296b4a/o4F5-Cm-gGdHPpX5rPVKx.png)
|
6 |
|
7 |
## Example
|
8 |
-
|
9 |
```python
|
10 |
import logging
|
11 |
import functools
|
@@ -83,6 +83,10 @@ if __name__ == "__main__":
|
|
83 |
|
84 |
protst_model = AutoModel.from_pretrained("Jiqing/ProtST-esm1b", trust_remote_code=True, torch_dtype=torch.bfloat16).to(device)
|
85 |
protein_model = protst_model.protein_model
|
|
|
|
|
|
|
|
|
86 |
text_model = protst_model.text_model
|
87 |
logit_scale = protst_model.logit_scale
|
88 |
logit_scale.requires_grad = False
|
|
|
5 |
![image/png](https://cdn-uploads.huggingface.co/production/uploads/62f0a673f0d40f6aae296b4a/o4F5-Cm-gGdHPpX5rPVKx.png)
|
6 |
|
7 |
## Example
|
8 |
+
The following script shows how to run ProtST with [optimum-intel](https://github.com/huggingface/optimum-intel) optimization on zero-shot classification task.
|
9 |
```python
|
10 |
import logging
|
11 |
import functools
|
|
|
83 |
|
84 |
protst_model = AutoModel.from_pretrained("Jiqing/ProtST-esm1b", trust_remote_code=True, torch_dtype=torch.bfloat16).to(device)
|
85 |
protein_model = protst_model.protein_model
|
86 |
+
+ import intel_extension_for_pytorch as ipex
|
87 |
+
+ from optimum.intel.generation.modeling import jit_trace
|
88 |
+
+ protein_model = ipex.optimize(protein_model, dtype=torch.bfloat16, inplace=True)
|
89 |
+
+ protein_model = jit_trace(protein_model, "sequence-classification")
|
90 |
text_model = protst_model.text_model
|
91 |
logit_scale = protst_model.logit_scale
|
92 |
logit_scale.requires_grad = False
|